var count = 0, timer;
document.onclick = function(){
if(count < 2){
if(timer){
clearTimeout(timer);
}
count ++;
timer = setTimeout(function(){
count = 0;
}, 500);
}else if(count === 2){
count = 0;
clearTimeout(timer);
threeClick();
}
}
function threeClick(){
alert(\'three click\');
}