<div id="zuo3"> <img name="img" onmouseover="bigger()" onmouseout="smaller()" src="img/1.jpg" style="cursor:pointer;width:100px;height:100px;" /> <img name="img" onmouseover="bigger()" onmouseout="smaller()" src="img/2.jpg" style="cursor:pointer;width:100px;height:100px;" /> <script type="text/javascript"> var img = document.getElementsByName('img'); function bigger(){ img.name.width = '200px'; img.name.height = '200px'; } function smaller(){ img.name.width = '90px'; img.name.height = '100px'; } </script> </div> 这是我的网页里的代码 我想把鼠标移到图片上的时候,就对图片进行放大,但是不知道为什么这样做会报错 我没怎么学习过js 所以请求大神帮忙解决一下
相关分类