鼠标悬停一段时间后触发事件
2011年06月01日
var mytimer = null; function beginEvent(){ //window.setTimeout("alert('Hello, world')", 1000); mytimer = window.setTimeout("myfunc('123','456')", 3000); } function cancelEvent() { clearTimeout(mytimer); mytimer = -1; } function myfunc(t1,t2) { alert(t1+" ,"+t2); if (mytimer == -1) return; var d = document.getElementById("div1"); d.innerText = new Date(); clearTimeout(mytimer); mytimer = null; }
注:此代码是强哥所写,偶是借来用用
2011年06月01日
var mytimer = null; function beginEvent(){ //window.setTimeout("alert('Hello, world')", 1000); mytimer = window.setTimeout("myfunc('123','456')", 3000); } function cancelEvent() { clearTimeout(mytimer); mytimer = -1; } function myfunc(t1,t2) { alert(t1+" ,"+t2); if (mytimer == -1) return; var d = document.getElementById("div1"); d.innerText = new Date(); clearTimeout(mytimer); mytimer = null; }
注:此代码是强哥所写,偶是借来用用