我有这个onclick
功能,它工作正常:
onclick="transferplayer('palyerlistDIVID','<?=$d_player['id']?>',document.getElementById('play perPosition').value,'teamID','plus','<?=$d_player['teamID']?>','<?=$d_player['price']?>');showmyplayer('myplayerlistDIVID',document.getElementById('playperPosition').value,'plus','<?=$d_player['teamID']?>','<?=$d_player['price']?>')"
我需要的是设置点击之间的时间,所以我添加了这个javascript,每次点击之间有5秒:
var lastClicked = 0;
function onClickCheck() {
var timeNow = (new Date()).getTime();
if (timeNow > (lastClicked + 5000)) {
// Execute the link action
} else {
alert('Please wait at least 5 seconds between clicks!');
}
lastClicked = timeNow;
}
问题是:如何将这段代码与onclick
函数结合起来?
我试过这个:
onclick="onClickCheck();transferplayer('palyerlistDIVID','<?=$d_player['id']?>',document.getElementById('play perPosition').value,'teamID','plus','<?=$d_player['teamID']?>','<?=$d_player['price']?>');showmyplayer('myplayerlistDIVID',document.getElementById('playperPosition').value,'plus','<?=$d_player['teamID']?>','<?=$d_player['price']?>')"
但是在点击它时,它总是取值。