案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function ifClosed()
5
  {
6
  document.write("'myWindow' has been closed!")
7
  }
8
9
function ifNotClosed()
10
  {
11
  document.write("'myWindow' has not been closed!")
12
  }
13
14
function checkWin()
15
  {
16
  if (myWindow.closed)
17
    ifClosed()
18
  else
19
    ifNotClosed()
20
  }
21
</script>
22
</head>
23
<body>
24
25
<script type="text/javascript">
26
myWindow=window.open('','','width=200,height=100')
27
myWindow.document.write("This is 'myWindow'")
28
</script>
29
30
<input type="button" value="Has 'myWindow' been closed?" onclick="checkWin()" />
31
32
</body>
33
</html>
34