double-clicking

 <!doctype html>
<button id="id0" onclick="w('id0','str0')">target0</button>
<button id="id1" onclick="w('id1','str1')">target1</button>
<script>
var flag = true;
var check_msecond = 0;
var check_id = '';
function w(id, str) {
var wdate = new Date();
var msecond = wdate.getTime();
check_msecond = msecond;
if (flag) {
flag = false;
check_id = id;
} else {
flag = true;
if (check_id == id) {
console.log('SAME-ID_' + id);
var past = msecond - check_msecond;
if (past <= 1000) {
wb(id, str);
} }
}
}
function wb(id, str) {
console.log('1000 millsecond later,not more than 3 seconds ' + id + str);
alert('do sth');
}
</script>
上一篇:重置mysql数据库密码相关方法


下一篇:node.js 使用NAPI写C++插件,(部分转帖)