<input name="test" id="test" type="button" onmousedown="mouseDown()" value="fasf"/>function mouseDown(ev){ count ++;
timer = window.setTimeout(function(){
if(count==1) alert(count);//结果是 单击1次 输出=1 双击 还是1
else alert(count);//三击 输出2 晕 没有道理啊
window.clearTimeout(timer);
count=0;
},500)}求解
timer = window.setTimeout(function(){
if(count==1) alert(count);//结果是 单击1次 输出=1 双击 还是1
else alert(count);//三击 输出2 晕 没有道理啊
window.clearTimeout(timer);
count=0;
},500)}求解
var count = 0,timer;
return function(){
count ++;
timer && window.clearTimeout(timer);
timer = window.setTimeout(function(){
if(count==1) alert(count);//结果是 单击1次 输出=1 双击 还是1
else alert(count);//三击 输出2 晕 没有道理啊
count=0;
},500)
}})();