日期:2014-05-18  浏览次数:20430 次

button enable是FALSE 经过5秒后使其enable为TRUE
button enable是FALSE 经过5秒后使其enable为TRUE

请问如何实现

------解决方案--------------------
<script type="text/javascript"> 
function restore() 

setTimeout( "document.getElementById('Button1').disabled=false;", 5000); 

</script> 

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="this.disabled=true;restore();" />
------解决方案--------------------
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
var clock;
function restore()
{
var btn = document.getElementById('<%= Button1.ClientID %>');
if(btn.disabled == true)
btn.disabled = false;
clearTimeout(clock);

}
function JiaZai()
{
clock = setTimeout('restore()', 5000);
}
</script>

</head>
<body onload="JiaZai()">
<form id="form1" runat="server">
<div>
<input id="Button1" disabled="disabled" runat="server" type="button" />
</div>
</form>
</body>
</html>

------解决方案--------------------
HTML code


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
 <input type="submit" name="Submit" value="同意" />
</form>
<script language="javascript">
document.form1.Submit.disabled = true;
var speed = 1000; //速度
var wait = 5; //停留时间
function updateinfo(){
  if(wait == 0){
    document.form1.Submit.value = "我同意";
    document.form1.Submit.disabled = false;
  }
  else{
    document.form1.Submit.value = "阅读条款"+wait;
    wait--;
    window.setTimeout("updateinfo()",speed);
  }
}
updateinfo();
</script>
</body>

</html>