<% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "Default. aspx. cs" Inherits = "_ Default" %>
Copy codeThe Code is as follows:
<! 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> Untitled Page </title>
<Script language = "javascript" type = "text/javascript">
Var YC = new Object ();
Function beginYC ()
{
Var secondsYC = document. getElementById ("txtYCSeconds"). value;
Try
{
YC = setTimeout ("alert ('latency" + secondsYC + "second successfully')", secondsYC * 1000 );
}
Catch (e)
{
Alert ("enter the correct number of seconds. ");
}
}
Function overYC ()
{
ClearTimeout (YC );
YC = null;
Alert ("delay terminated successfully. ");
}
/************************** Use of the timer, timer, and timer ** ******************************/
Var timerDS = new Object ();
Var timerDDS = new Object ();
Function beginDS ()
{
Sn. innerHTML = "0 ";
TimerDS = setInterval ("addOne ()", parseInt (document. getElementById ("txtIntervalSeconds"). value, 10) * 1000 );
}
Function goonDS ()
{
TimerDS = setInterval ("addOne ()", parseInt (document. getElementById ("txtIntervalSeconds"). value, 10) * 1000 );
}
Function overDS ()
{
ClearInterval (timerDS );
TimerDS = null;
}
Function delayDS ()
{
OverDS ();
TimerDDS = setTimeout ("goonDS ()", document. getElementById ("txtDDSSeconds"). value * 1000 );
}
Function addOne ()
{
If (sn. innerHTML = "10 ")
{
OverDS ();
Alert ("congratulations, it has been successfully set to 10 seconds ");
Return;
}
Sn. innerHTML = parseInt (sn. innerHTML, 10) + 1;
}
</Script>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div>
Use of delimiters: </div>
<Div>
<Label id = "Label2" title = "delay seconds:"> </label>
<Input type = "text" id = "txtYCSeconds" value = "3"/>
<Input type = "button" id = "btnBYC" onclick = "javascript: beginYC ()" value = "Start delay"/>
<Input type = "button" id = "btnOYC" onclick = "javascript: overYC ()" value = "End Delay"/>
<Input type = "button" id = "Button1" onclick = "javascript: alert ('good monrning');" value = "normal pop-up window"/>
</Div>
<Br/>
<Div>
Timer usage: </div>
<Div>
<Div id = "sn"> 0 </div>
<Label id = "Label1" title = "scheduled interval seconds:"> </label>
<Input type = "text" id = "txtIntervalSeconds" value = "1"/>
<Input type = "button" id = "btnBDS" onclick = "javascript: beginDS ()" value = "Start Time"/>
<Input type = "button" id = "btnODS" onclick = "javascript: overDS ()" value = "timed termination"/>
<Input type = "button" id = "btnGDS" onclick = "javascript: goonDS ()" value = "Continue timing"/>
<Label id = "ds" title = "delay seconds:"> </label>
<Input type = "text" id = "txtDDSSeconds" value = "5"/>
<Input type = "button" id = "btnDDS" onclick = "javascript: delayDS ()" value = "delayed timing"/>
</Div>
</Form>
</Body>
</Html>