BOM编程window的open和close
002-open.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>close</title>
</head>
<body>
<input type="button" value="关闭当前窗口" onclick="window.close();" />
</body>
</html>
001-BOM编程-open和close.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>BOM编程-open和close</title>
</head>
<body>
<script type="text/javascript">
/*
1、BOM编程中,window对象是顶级对象,代表浏览器窗口。
2、window有open和close方法,可以开启窗口和关闭窗口。
*/
</script>
<input type="button" value="开启百度(新窗口)" onclick="window.open('http://www.baidu.com');" />
<input type="button" value="开启百度(当前窗口)" onclick="window.open('http://www.baidu.com', '_self');" />
<input type="button" value="开启百度(新窗口)" onclick="window.open('http://www.baidu.com', '_blank');" />
<input type="button" value="开启百度(父窗口)" onclick="window.open('http://www.baidu.com', '_parent');" />
<input type="button" value="开启百度(顶级窗口)" onclick="window.open('http://www.baidu.com', '_top');" />
<input type="button" value="打开表单验证" onclick="window.open('002-open.html')"/>
</body>
</html>