javascript 自动跳转

如何用javascript作自动跳转?
 
 
----------------
<%@ page contentType="text/html;charset=gb2312" language="java" %>
 
<body onLoad="directe()">
.....
 
<%
String url=(String)session.getAttribute("url");
if(url!=null){
request.setAttribute("url",url);
session.removeAttribute("url");
}else{
request.setAttribute("url","");
session.removeAttribute("url");
}
%>
<script language="javascript">
function directe() {
var url="<%=request.getAttribute("url")%>";
if(window.opener==null){
window.location.href="<%=request.getContextPath()%>"+url;
} else{
if(url==null||url.length==0){
window.opener.location.href=window.opener.location.href;
}else {
window.opener.location.href="<%=request.getContextPath()%>"+url;
}
}
}
function preClose() {
window.close();
}
setTimeout(preClose, 0);
</script>
 
</body>
 
原文地址:https://www.cnblogs.com/huapox/p/3516345.html