var i=0; var int=self.setInterval(function(){ console.log(i++); change_img(); },20); clearInterval(int); //停止定时器
javascript中防止重复点击、防止点击过快实用方法
转自i https://blog.csdn.net/jiangwei1994/article/details/80774214
var isclick = true; function post_test() { if (isclick) { isclick = false; //--- var posturl = "/Home/P_Getcode"; var formData = new FormData(); myxhr.mypost(posturl, 'json', formData, callback_1); //--- setTimeout(function () { isclick = true; }, 500); } }