(049)javascript_event_offset
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>EVENT</title> 6 <style type="text/css"> 7 #myDiv{ 8 width: 90px; 9 height: 90px; 10 background: blue; 11 border: 1px solid black; 12 padding: 10px; 13 margin: 20px; 14 position: absolute; 15 left: 100px; 16 top: 100px; 17 } 18 </style> 19 <script type="text/javascript"> 20 21 window.onload = function() { 22 23 var divNode = document.getElementById("myDiv"); 24 25 alert(divNode.offsetWidth); 26 alert(divNode.offsetHeight); 27 alert(divNode.offsetLeft); 28 alert(divNode.offsetTop); 29 30 }; 31 32 </script> 33 </head> 34 35 <body> 36 37 <div id="myDiv"></div> 38 39 </body> 40 </html>
***万事万物都有裂痕,那是光照进来的地方***

浙公网安备 33010602011771号