Breaking News

【JavaScript】開新網頁和關閉範例



  
<html>
<head>
<title>開新網頁和關閉範例</title>
<script type="text/javascript">
    var win;
    function createWin() {
       win = window.open("","","width=300,height=200");
    }
    function closeWin() {
        if (win) {
            win.close();
        }
    }
</script>
</head>
<body>
<form>
<input type="button" value="創建新窗口" onclick="createWin()">
<input type="button" value="關閉新窗口" onclick="closeWin()">
</form>
</body>
</html>



沒有留言