日期:2014-05-16 浏览次数:20477 次
<%@ page contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
??? <title> 测试</title>
??? <script>
??? var clickRepeat;
??? var clickCount=0;//点击次数
??? var clickDelay=300;//点击时间间隔(毫秒)
??? function checkClick() {
??? ??? clearTimeout(clickRepeat);
??? ??? clickCount++;
??? ??? if(clickCount==1) {
??? ??? ??? clickRepeat=setTimeout("doEvent('click');clickCount=0",clickDelay);
??? ??? }
??? ??? else {
??? ??? ??? doEvent("dblclick");
??? ??? ??? clickCount=0;
??? ??? }
??? }
??? function doEvent(obj)
??? {
??? ??? if(obj== "click")
??? ??? ??? alert("click");
??? ??? if(obj== "dblclick")
??? ??? ??? alert("dblclick");
??? }
??? ???
??? </script>
</head>
?
<body>
<a href="#" onmouseup="checkClick()" >点击/双击测试</a>
</body>
</html>
?