為什么加了按鈕后網(wǎng)頁(yè)不會(huì)自動(dòng)關(guān)閉了
<!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://idcbgp.cn"); ?????????setTimeout("mywin.close()",1000); ?} ??</script> </head> <body> ????<input?name="button"?type="button"?onClick="rec()"?value?=?"點(diǎn)擊查看網(wǎng)頁(yè)"??/> </body> </html>
2017-03-08
<!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://idcbgp.cn");
? ? ? ? ?setTimeout('1000');
? ? ? ? ?mywin.close()
?}
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value = "點(diǎn)擊查看網(wǎng)頁(yè)" ?/>
</body>
</html>
這樣就自動(dòng)關(guān)閉了。