Use Javascript in ASP. NET to automatically redirect page timing (timing)
This article mainly introduces ASP. NET with JavaScript to achieve page timing (timing) Automatic jump, this article mainly relies on JS implementation requirements, only in ASP.. NET. For more information, see.
ASP. NET Enables automatic page Jump (tested, which can be passed in VS2008 C # environment)
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
<% @ 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> </title> <Script type = "text/javascript"> Var I = 5; // Obtain logon events and handle Automatic redirects Window. onload = function JumpPage () { Document. getElementById ("time"). innerText = I; // Jump immediately after the timer is 0 I --; If (I <0) { Location. replace ("http://www.baidu.com "); } SetTimeout ("JumpPage ()", 1000 ); } </Script> </Head> <Body> <Form id = "form2" runat = "server"> <Div id = "AutoJumpPage"> Welcome to the <span id = "time" style = "color: # FF0000 "> </span> seconds after automatic jump to <a href =" http://www.baidu.com "> Baidu </a> <Br/> If you want to jump to the page immediately, click <a href = "http://www.baidu.com" style = "color: # FF00FF"> jump now >></a> </Div> </Form> </Body> </Html> |