码迷,mamicode.com
首页 > 其他好文 > 详细

单击循环事件

时间:2017-09-09 18:15:09      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:doc   ++   body   click   src   ==   var   ima   this   

<body>
<img src="images/hot.jpg" 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>

单击循环事件

标签:doc   ++   body   click   src   ==   var   ima   this   

原文地址:http://www.cnblogs.com/wanan-01/p/7498701.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!