JS中图片的放大缩小没反应

时间:2023-03-08 19:32:59
JS中图片的放大缩小没反应

这段代码无反应:

JS中图片的放大缩小没反应

代码如下:

 <script type="text/javascript">
onload = function () {
document.getElementById('dv1').onmouseover = function () {
var imgObj1 = document.createElement('img');
imgObj1.setAttribute('src', '1224164136-0.jpg');
imgObj1.width = '800px';
imgObj1.height = '800px'; imgObj1.style.position = 'absolute';
imgObj1.style.left = this.offsetLeft + 'px';
imgObj1.style.top = this.offsetTop + this.offsetHeight + 'px';
document.body.appendChild(imgObj1);
}
}
</script>
</head>
<body>
<div id="dv1">
哎呀<img id="img1" title="美人" alt="刷新加载" src="1224164136-0.jpg" style="width:900px;height:900px" />
</div>

JS中图片的放大缩小没反应

各位兄弟看看是哪里的问题,小弟不胜感激!