这段代码无反应:
代码如下:
1 <script type="text/javascript"> 2 onload = function () { 3 document.getElementById(‘dv1‘).onmouseover = function () { 4 var imgObj1 = document.createElement(‘img‘); 5 imgObj1.setAttribute(‘src‘, ‘1224164136-0.jpg‘); 6 imgObj1.width = ‘800px‘; 7 imgObj1.height = ‘800px‘; 8 9 imgObj1.style.position = ‘absolute‘; 10 imgObj1.style.left = this.offsetLeft + ‘px‘; 11 imgObj1.style.top = this.offsetTop + this.offsetHeight + ‘px‘; 12 document.body.appendChild(imgObj1); 13 } 14 } 15 </script> 16 </head> 17 <body> 18 <div id="dv1"> 19 哎呀<img id="img1" title="美人" alt="刷新加载" src="1224164136-0.jpg" style="width:900px;height:900px" /> 20 </div>
各位兄弟看看是哪里的问题,小弟不胜感激!
时间: 2024-11-18 17:09:32