鼠标左键长按事件
:demo»
<p><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br><html xmlns="http://www.w3.org/1999/xhtml"><br><head><br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br><title>鼠标长按</title><br></head><br><body><br><input type="button" value="鼠标长按" class="lognPress" /><br>长按时间:<span class="time">0</span> 秒<br><script type="text/javascript" src="http://www.chenfahui.cn/ziliao/js/jquery-1.4.1.min.js"></script><br><script type="text/javascript"><br>$(function(){<br> $(".lognPress").mousedown(function(){<br> var i = 0;<br> var _this = $(this);<br> timer = setInterval(function(){<br> i+=10;<br> if(i >= 1000){<br> i = 0;<br> lognPress();<br> }<br> },10)<br> }).mouseup(function(){clearTimeout(timer);});<br>})<br>var time = 0;<br>function lognPress(){<br> time++;<br> $(".time").html(time);<br>}<br></script><br></html></p>