这里是我的空间,是我用来记录点滴的沃土...

倒计时实现网页跳转

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="MenuApplication.WebForm1" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!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;
var redirectUrl = function() {
document.getElementById(
"time").innerHTML = i + "";
if (i == 0) {
window.location.href
= 'http://www.baidu.com';

}
else if (i < 0) {
clearInterval(timeId);
}
i
--;
}
var timeId = setInterval(redirectUrl, 1000);
</script>

</head>
<body>
<form id="form1" runat="server">
<div id="time" style="font-family: 楷体; font-size: xx-large; color: Red;">
</div>
</form>
</body>
</html>
posted @ 2012-01-16 18:57  wsx2miao  Views(292)  Comments(0Edit  收藏  举报
这里是我的空间,是我用来记录点滴的沃土...