在打开一个新的页面后,想要原来的页面自动关闭的问题。
我这段代码可以实现关闭,但是会弹出提示窗口,问你当前窗口要关闭,让你选择。但我想要的效果是自动关闭,不要弹出提示框架,请问怎么做?
代码如下:
<html>
<head>
<%
if session("spass")="" and session("sname")="" then
response.Write("您还没有登录或者网页已经过期,请回到<a href='../index.asp' >登录</a>页面!")
else
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/Style.css" rel="stylesheet" type="text/css">
<script language="javascript">
function closeit()
{
setTimeout("self.close()",6000);
window.openner=null;
}
</script>
<script language="javascript">
function close1(url)
{
var newwin=window.open(url,"winname","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=800,height=600");
newwin.focus();
return(newwin);
}
</script>
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-weight: bold;
}
.style2 {
color: #0000FF;
font-weight: bold;
}
.style3 {color: #0000FF}
.style6 {
color: #003300;
font-weight: bold;
}
.style7 {
color: #333300;
font-weight: bold;
}
.style8 {color: #003300}
-->
</style>
</head>
<body OnLoad="closeit()">
<p align="center" class="style1"> </p>
<p align="center" class="style1"><a href="11.asp">返回主页面</a></p>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="49" height="35" background="../image/HOME_BG3.GIF"> </td>
<td height="35" background="../image/HOME_BG9.GIF"> <div align="center"><span class="Xsmall"><font color="#FF0000"><strong>欢迎光临基于web的在线考试系统</strong></font></span></div></td>
<td width="13" height="1"><img src="../image/home_bg8.gif" width="13" height="12"></td>
</tr>
<tr>
<td width="49" background="../image/HOME_BG1.GIF"> <br> </td>
<td background="../image/home_bg10.gif"> <p><span class="Xsmall">
<%
response.write(" "& session("name")&"同学:")
%>
<br>
请验证一下你的学号是否正确!<img src="../image/forword_1.gif" width="16" height="15">
<%response.write("<font color=red>"&session("sname")&"</font>")%>
<br>
若正确请点击开始进入在线考试,若错误请于考场老师联系!<br>
<br>
<img src="../image/announce.gif" width="18" height="18">
在正式考试前,请阅读本考场规则,如下:</span></p>
<blockquote>
<p> <img src="../image/forget_1.gif" width="14" height="14"> <span class="Xsmall"><font color="#FF0000">答完题后记得</font><span class="style6">一定要保存答案</span><font color="#FF0000">,</font><span class="style3">否则成绩为0,<span class="style8">同时注意一但保存试卷后就不能再继续答题!</span></span></span><font color="#FF0000">保存完后记得要</font><span class="style7">提交试卷</span><font color="#FF0000">,</font><span class="style3">否则成绩同样为0!</span><br>
<img src="../image/forget_1.gif" width="14" height="14"> <span class="Xsmall"><font color="#FF0000">请不要点击刷新、后退等违纪按钮</font></span><br>
<img src="../image/forget_1.gif" width="14" height="14"> <span class="Xsmall"><font color="#FF0000">准时交卷,不拖交,时间到了系统会强制交卷!不允许继续答题!<br>
<img src="../image/forget_1.gif" width="14" height="14"> 不要违反考试各项规则<br>
<img src="../image/forget_1.gif" width="14" height="14"> 若违反,一律以零分处置</font></span></p>
</blockquote></td>
<td width="13" background="../image/home_bg7.gif"> </td>
</tr>
<tr>
<td width="49" height="42" background="../image/HOME_BG2.GIF"> </td>
<td height="22" background="../image/home_bg10.gif" bgcolor="#FFFFFF"><div align="center" class="style2"><a href="#" onClick="JavaScript:close1('gonewtest.asp')">开始考试
</a> </div></td>
<td width="13" height="22" background="../image/HOME_BG7.GIF"> </td>
</tr>
<tr>
<td height="12" background="../image/HOME_BG4.GIF"> </td>
<td background="../image/HOME_BG5.gif"> </td>
<td background="../image/HOME_BG6.GIF"> </td>
</tr>
</table>
<%end if%>
</body>
</html>
代码中的两个javascript 脚本一个是实现关闭,一个是实现打开一个没有工具栏等属性的新窗口。主要是关闭的那个实现不了我要的效果。