页面自动跳转,jsp

<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path
= request.getContextPath();
String basePath
= request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'zidongtiaozhuan.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>
<SCRIPT LANGUAGE="JavaScript">
var time
= 4; //时间,秒

function Redirect(){
window.location
= "http://www.baidu.com";
}
var i
= 0;
function dis(){
if(i<time){
document.all.s.innerHTML
= "还剩" + (time - i-1) + "";
i
++;
}
}
timer
=setInterval('dis()', 1000);//显示时间
timer=setTimeout('Redirect()',time * 1000); //跳转

</SCRIPT>
<BODY>
<span id="s"></span>
</BODY>
</HTML>
--------------------------------------- 贵有恒,何必三更起五更眠。最无益,只怕一日曝十日寒。--------------------------------------------
原文地址:https://www.cnblogs.com/lhxfzu/p/2032263.html