我写了两个函数,一个打开窗口,一个关闭窗口,为什么不起作用呢?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>close()</title>
<script type="text/javascript">
var mywin;
function openWindow(){
mywin=window.open("http://www.imooc.com",'_blank');
}
function closeWindow(){
mywin.close();
}
</script>
</head>
<body>
<form>
<input type="button" value="新建窗口" onclick="closeWindow()" />
<input type="button" value="关闭窗口" onclick="closeWindow()" />
</form>
</body>
</html>