蒲蒲森
2017-03-08 16:41
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>close()</title> <script type="text/javascript"> function rec(){ var mywin=window.open("http://www.imooc.com"); setTimeout("mywin.close()",1000); } </script> </head> <body> <input name="button" type="button" onClick="rec()" value = "点击查看网页" /> </body> </html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>close()</title>
<script type="text/javascript">
function rec(){
var mywin=window.open("http://www.imooc.com");
setTimeout('1000');
mywin.close()
}
</script>
</head>
<body>
<input name="button" type="button" onClick="rec()" value = "点击查看网页" />
</body>
</html>
这样就自动关闭了。
JavaScript入门篇
739817 学习 · 9566 问题
相似问题