<script>
var temp = 0;
var doNumber = 0;
var clearTimeOut = null;
var SetTimeOut = null;
function abc_onClick()
{
temp = temp + 1;
tempValueChanage();
}
function tempValueChanage()
{
doNumber = doNumber + 1;
SetTimeOut = setTimeout(tempValueChanage,300);
if( doNumber >= 2 && temp == 1)
{
temp = 0;
doNumber = 0;
clearTimeout(SetTimeOut);
alert("单击事件!");
}
if( temp == 0 )
{
clearTimeout(SetTimeOut);
doNumber = 0;
}
}
function abc_onDblClick()
{
temp = 0;
doNumber = 0;
alert("双击事件!");
}
</script>
<input id="spanData" type="button" value="onClick or onDblClick" onDblClick="abc_onDblClick()" onClick="abc_onClick()">
本文转自高海东博客园博客,原文链接:http://www.cnblogs.com/ghd258/archive/2005/10/11/252576.html如需转载请自行联系原作者