单击循环事件

<body>
<img src="images/hot.jpg" alt="" id="imgId"/>
</body>
<script>
i=0;
var imgObj=document.getElementById("imgId");
imgObj.onclick=function(){
if(i%2==0){
this.src="images/hot1.jpg"
}else{
this.src="images/hot.jpg"
}
i++;
}
</script>
posted @ 2017-09-09 17:06  wanan_01  阅读(152)  评论(0编辑  收藏  举报