<html> |
<head> |
<meta http-equiv= "Content-Type" content= "text/html; charset=gb2312" > |
<title>控制窗口的打开和关闭</title> |
<style type= "text/css" > |
<!-- |
/* 用于网页的CSS样式 */ |
body { |
font-family: "宋体" ; |
font-size: 9pt; |
margin-top: 0px; |
margin-left: 0px; |
margin-right: 0px |
} |
A { |
color: black; |
font-size: 9pt; |
font-weight: 400; |
text-decoration: none |
} |
A:hover { |
color: red; |
font-size: 9pt; |
font-weight: 400; |
text-decoration: underline |
} |
a:active { |
font: 9pt "宋体" ; |
cursor: hand; |
color: #FF0033 |
} |
--> |
</style> |
<meta http-equiv= "Content-Type" content= "text/html; charset=gb2312" > |
<script language= "javascript" > |
<!-- |
function openclk() // 函数: 打开新的窗口。 |
{ |
another=open( 'about:blank' , 'NewWindow' , "height=150, width=250" ); // 调用window窗口对象的open来打开新窗口 |
} |
function closeclk() // 函数: 关闭打开的窗口 |
{ |
another.close(); // 调用close函数关闭窗口 |
} |
//--> |
</script> |
</head> |
<body> |
<center> |
<h1>控制窗口的打开和关闭</h1> |
<hr> |
<br> |
<table border=0 bordercolor=blue borderlight=green style= "border-collapse: collapse" cellpadding= "0" cellspacing= "0" > |
<tr> |
<td align=center><font size=4 color=red face= "arial, helvetica, sans-serif" ><strong>试试点击按钮看看!</strong></font></td> |
</tr> |
<tr> |
<td align=center height=100 width=300><form> |
<!-- 为按钮的onclick绑定openclk函数 --> |
<input type= "button" name= "open" value= "打开一个窗口" onClick= "openclk()" > |
<br> |
<!-- 为按钮的onclick绑定closeclk函数 --> |
<input type= "button" name= "close" value= "关闭这个窗口" onClick= "closeclk()" > |
</form></td> |
</tr> |
</table> |
</center> |
</body> |
</html> |