ASP.NET實現頁面自動跳轉(經測試,在VS2008 C#環境下可通過)
<%@ 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; // 獲取登錄事件,並處理自動跳轉 window.onload = function JumpPage() { document.getElementById("time").innerText = i; // 計時為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"> 歡迎您,本頁將在<span id="time" style="color: #FF0000"></span>秒後自動跳轉至<a href="http://www.baidu.com">百度</a> <br /><br /> 如需立即跳轉,請直接點擊 <a href="http://www.baidu.com" style="color: #FF00FF">立即跳轉>></a> </div> </form> </body> </html>