The page code is as follows:
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs" inherits = "_ default" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> button countdown </title>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: button id = "button1" runat = "server" text = "button"/> </div>
<SCRIPT type = "text/JavaScript" Language = "JavaScript">
VaR secs = 10;
VaR wait = secs * 1000;
VaR agreetext = "agree ";
Document. form1.button1. value = agreetext + "(" + secs + ")";
Document. form1.button1. Disabled = true;
For (I = 1; I <= secs; I ++ ){
Window. setTimeout ("Update (" + I + ")", I * 1000 );
}
Window. setTimeout ("timer ()", wait );
Function Update (Num, value ){
If (num = (wait/1000 )){
Document. form1.button1. value = agreetext;
} Else {
Printnr = (wait/1000)-num;
Document. form1.button1. value = agreetext + "(" + printnr + ")";
}
}
Function timer (){
Document. form1.button1. Disabled = false;
Document. form1.button1. value = agreetext;
}
</SCRIPT>
</Form>
</Body>
</Html>
Note the following:
1. setTimeout (expression, delay time)
During execution, an expression is executed after a specified time delay after loading.
2. Javascript must be placed in <form> and </form>.
3. Only java scripts in <form> and </form> can use "document. form1. Service Control name" to reference service-type controls on the page. If you place a Java Script in the