1. 程式人生 > >html dom window物件

html dom window物件

html主頁面
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script type="text/javascript" src="js/write.js"></script>
    <script type="text/javascript">
        var time;
        function 
windows() { //dom窗體的物件屬性 var name=window.navigator.appName; var version=window.navigator.appVersion; println(name+":"+version); } function windows1() { var protocol=window.location.protocol; var href=window.location.href; println
(protocol+"+++"+href); //location.href="http://www.baidu.com"; } function windowConfirm() { var result=confirm("確定要取消嗎?"); println("結果"+result); } function test() { // setTimeout("alert('羞羞')",4000); time=setInterval("alert('請註冊')",4000); } function
windowMove() { //模擬視窗震動 for(var i=0;i<700;i++) { moveBy(30,0); moveBy(0,30); moveBy(-30,0); moveBy(0,-30); } } function stop() { clearInterval(time); } function windowOpen() { open("ad.html","","width=100,height=100"); } onload = function () { alert("onload"); status="hehe"; } onunload = function () { alert("onunload"); } onbeforeunload = function () { alert(" onbeforeunload "); } </script> <input type="button" value="確認框" onclick="windowConfirm()"> <input type="button" value="窗體物件" onclick="windows1()"/> <input type="button" value="震動" onclick="windowMove()"/> <input type="button" value="測試" onclick="test()"/> <input type="button" value="停止" onclick="stop()"/> <input type="button" value="廣告" onclick="windowOpen()"/> </body> </html>  廣告頁面
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script type="text/javascript">
        setTimeout("close()",4000);
    </script>
    <h1>這是一則廣告</h1>
</body>
</html>