一个网页一共有4个按钮,其中3个按钮,分别用window.open()事件,打开3个网页。
最后一个按钮是重登陆按钮,点击该按钮时将打开的网页都关闭。如何写?
<html>
<head>
<script>
function openwindowXX(url, winName, width, height)
{
if(winName==05){
cc=window.open( url,winName,width=1024,height=768);
}
if(winName==06){
ca=window.open( url,winName,width=1024,height=768 );
}
if(winName==07){
cb=window.open( url,winName,width=1024,height=768);
}
}
</script>
</head>
<body>
<table>
<tr>
<td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('a.html','05');"><img border="0" src="/images/top/top_menu_05up.jpg" name="img05"></a>
</td><td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('b.html','06');"><img border="0" src="/images/top/top_menu_06up.jpg" name="img06"></a>
</td><td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('c.html','07');"><img border="0" src="/images/top/top_menu_07up.jpg" name="img07"></a>
</td>
<td><input type="button" value="重登陆"/></td>
</tr>
</table>
</body>
</html>
最后一个按钮是重登陆按钮,点击该按钮时将打开的网页都关闭。如何写?
<html>
<head>
<script>
function openwindowXX(url, winName, width, height)
{
if(winName==05){
cc=window.open( url,winName,width=1024,height=768);
}
if(winName==06){
ca=window.open( url,winName,width=1024,height=768 );
}
if(winName==07){
cb=window.open( url,winName,width=1024,height=768);
}
}
</script>
</head>
<body>
<table>
<tr>
<td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('a.html','05');"><img border="0" src="/images/top/top_menu_05up.jpg" name="img05"></a>
</td><td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('b.html','06');"><img border="0" src="/images/top/top_menu_06up.jpg" name="img06"></a>
</td><td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('c.html','07');"><img border="0" src="/images/top/top_menu_07up.jpg" name="img07"></a>
</td>
<td><input type="button" value="重登陆"/></td>
</tr>
</table>
</body>
</html>
<head>
<script>
function openwindowXX(url, winName, width, height)
{
if(winName==05){
cc=window.open( url,winName,width=1024,height=768);
}
if(winName==06){
ca=window.open( url,winName,width=1024,height=768 );
}
if(winName==07){
cb=window.open( url,winName,width=1024,height=768);
}}
</script>
</head>
<body>
<table>
<tr>
<td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('http://www.scriptlover.com','05');"> open </a>
</td> <td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('http://www.scriptlover.com','06');"> open </a>
</td> <td width="90" height="26" >
<a style="cursor:hand" href="javascript:openwindowXX('http://www.scriptlover.com','07');"> open </a>
</td>
<td> <input type="button" value="重登陆" onclick="cc.close();ca.close();cb.close();" /> </td>
</tr>
</table>
</body>
</html>
close前应该先
if(ca)//或者其他两个嘛~哈哈~
like thisif(ca)ca.close();//这个不会出错.ca.close();//这个在没打开ca那窗口的时候运行肯定出错.