今天上午学了的BOM模型中常用对象,了解了一部分的属性

For循环的规律

外层循环控制行

内层循环控制列

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>BOM模型中常用对象</title>
<script type="text/javascript">
    function testalert(){
//        有widow的时候可以省略不写window
        window.alert("你好吗");
    }
    function testconfirm(){
//        有widow的时候可以省略不写window
        var mes=window.confirm("您确定要退出吗");
        /*if(mes==true)*/
        if(mes){
            //关闭窗口
            window.close();
        }
    }
    function testprompt(){
//        有widow的时候可以省略不写window
        var name=window.prompt("请输入你的名字");
        //prompt返回值是字符串   "1"
        //在需要计算的时候需要转成数值类型再计算
        alert(name);
    }
    function testscroll(){
        window.scrollBy(50,50);
    }
    
</script>
</head>

<body>
<input type="button" value="滚动" onClick="testscroll()">
<div style="width:2000px;height: 200px;background: red"></div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>