关闭窗口并打开一个新窗口

时间:2012-09-22 01:19:55

标签: javascript html window

我正在尝试做的是当页面加载它时 自动关闭窗口然后打开一个新窗口

这是我正在使用的代码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv="prahma" content="no-cache">
<title>Auto Close and Open New window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="javascript">
var url = "step5.php"
window.open(url,"","");
window.open('', '_self', ''); 
window.close();
</script>

</head>
<body onload="closeIt();">
</body>
</html>

窗口关闭但不会打开新窗口。

1 个答案:

答案 0 :(得分:1)

您必须先打开新窗口然后关闭旧窗口。