<script type="text/javascript">
window.onload = function () {
var inter = null;
var i = 10;
function count() {
var button1 = document.getElementById("register");
button1.disabled = true;
inter = setInterval(startCount, 1000);
}
function startCount() {
var button = document.getElementById("register");
if (i > 0)
{
button.value = i--;
}
else {
button.value = i;
clearInterval(inter);
button.disabled = false;
}
}
count();
}
</script>
运行结果
|
|