function $(id)
{
return document.getElementById(id);
}
var remain=5;
function init()
{
$("btnok").innerHTML="同意("+(remain--)+"秒)";
if(remain>0)
{
window.setTimeout(init,1000);
}
else
{
$("btnok").disabled=false;
$("btnok").innerHTML="同意";
}
}
</script>
然后在<body onload="init()"></body>
<button id="btnok" disabled="disabled" style=" 150px; height: 40px; font-size: large;"
onclick="javascript:window.location.href='注册页面'">同意</button>
<button id="btncancel" style=" 150px; height: 40px; font-size: large" onclick="javascript:window.history.back()">不同意</button>