[javascript]代码库
<html>
<head>
<title>打开多个窗口</title>
<script type="text/javascript">
myWebpage1=window.open("","myWebpage1","width=200,height=100");
myWebpage2=window.open("","myWebpage2","width=200,height=100");
myWebpage3=window.open("http://www.baidu.com");
myWebpage1.document.write("这是第一个窗口!");
myWebpage1.document.write("<HEAD><TITLE>新窗口一</TITLE></HEAD>");
myWebpage2.document.write("这是第二个窗口!");
myWebpage2.document.write("<HEAD><TITLE>新窗口二</TITLE></HEAD>");
function closeWin()
{
switch(form1.Select1.selectedIndex)
{
case 0:
myWebpage1.close();
alert("新窗口一已经关闭!");
break;
case 1:
myWebpage2.close();
alert("新窗口二已经关闭!")
break;
case 2:
myWebpage3.close();
alert("http://www.baidu.com已经关闭!")
break;
}
}
</script>
<style type="text/css">
#Select1 {
width: 102px;
}
</style>
</head>
<body>
<div style="background-color: #9acdcd">
<form name="form1" id="form1">
<p>请选择要关闭的窗口:
<select id="Select1" name="D1">
<option>新窗口一</option>
<option>新窗口二</option>
<option>百度</option>
</select>
<input id="Button1" type="button" value="关闭" onclick="closeWin()"/>
</form>
</div>
</body>
</html>