asp.net倒计时自动跳转指定页面

时间:2021-10-01 00:35:48
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login_tiao.aspx.cs" Inherits="Login_tiao" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>跳转页面</title>
<script type="text/javascript">
var i = 3;//设置跳转的时间
window.onload = function page_cg() {
document.getElementById("time").innerText = i;
i--;
if (i == 0) {
window.location.href='xxxxx.aspx'//跳转到指定页面
}
setTimeout(page_cg, 1000);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
3秒后自动跳到用户信息页面<a href="xxxxx.aspx"></a>...还剩<span id="time" style="font-weight:bold;color: blue"></span>秒!
<br />
</div>
</form>
</body>

</html>

asp.net倒计时自动跳转指定页面


在你之间的Login.aspx.cs中加入
Response.Redirect("Login_tiao.aspx");跳转即可