JS_點擊事件_彈出窗口_自動消失


<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>電燈開關案例</title>


<script>
    /** 練習:點擊按鈕,開燈或關燈 */
    var flag = false;//false表示默認狀態為關燈
    function changeImg(){
        console.log("this is show work good!");
        showInfo=window.open("3.html",'','width=200,height=100');
    }
    function closeit()
    {
    setTimeout("showInfo.close()", 2000)   //毫秒
    }
   
</script>
</head>
<body>
    <input type="button" value="開/關燈"
        onclick="changeImg()" /> <br/><br/>

<body onload="closeit()">    
</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM