js部分
disabled这个属性,要移除这个属性才可以取消禁用,因为不论它的值是什么都会起到禁用的效果
function down(){
if(but[0].getAttribute('value') == '注册'){
but[0].setAttribute('value', '10');
but[0].setAttribute('disabled', 'true');
}
else if(but[0].getAttribute('value') == 1){
but[0].setAttribute('value', '注册');
but[0].removeAttribute('disabled');
clearInterval(runId);
}
else but[0].setAttribute('value', parseInt(but[0].getAttribute('value')) - 1);
}
window.setInterval(run , 1000);
var but = document.getElementsByTagName('input');
but[0].style.width = '100px';
but[0].style.height = '100px';
var runId = window.setInterval(down, 1000);
/*html部分*/<input type="button" value="注册" />