<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 所以請求大神幫忙解決一下
求助js如何對多個圖片進行作用
揚帆大魚
2018-07-21 13:26:43