js實現多張圖片放大


<head>
<script type="text/javascript">
function bigger(obj){
obj.width='200px';
obj.height='200px';
}
function smaller(){
obj.width='90px';
obj.height='100px';
}
</script>
</head>
<body>
<div id='zuo3'>
<img name="image1" onmouseover="bigger(this)" onmouseout="smaller(this)" src="img/1.jpg"
style="cursor:pointer;width:100px;height:100px;"/>
<img name="image2" onmouseover="smaller(this)" onmouseout="smaller(this)" src="img/2.jpg"
style="cursor:pointer;width:100px;height:100px;"/>
</div>
</body>

</html>


注:針對多張圖片,需要用this結合functionXXX(obj),定位到當前作用對象

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章