為啥在寫關(guān)閉時(shí)間的時(shí)候不管用?
為啥在寫關(guān)閉時(shí)間的時(shí)候不管用?
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>close()</title>
? <script type="text/javascript">
? ? ?
? ? ?function openUrl(){
? ? ? ? ?var mywin=window.open("http://idcbgp.cn");
? ? ? ? ?setTimeout("mywin.close()",3000);
? ? ? ? ?mywin.close(); ? ? ??
? ?}
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="openUrl()" value="點(diǎn)擊我!" />
</body>
</html>
2017-02-23
function openUrl(){
? ? ? ? ?var mywin=window.open("http://idcbgp.cn");
? ? ? ? ?setTimeout("mywin.close()",3000);
? ? ? ? ?mywin.close(); ? ? ??
? ?}
你這段代碼中setTimeout("mywin.close()",3000);沒有執(zhí)行,你是打開的同時(shí)直接就關(guān)閉,剛open就close了
2017-02-23
你是想寫先開啟,幾秒后自動(dòng)關(guān)閉吧??梢赃@樣
function openUrl(){
???????? var mywin=window.open("http://idcbgp.cn");
???????? setTimeout(function(){mywin.close()},5000);
? ??? ?}
2017-02-23
你這個(gè)沒有錯(cuò) ?只是你點(diǎn)擊的時(shí)候開啟和關(guān)閉幾乎同時(shí)進(jìn)行的 ?