对网页进行的操作

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            p{position:fixed;left:0;top:0;}
        </style>
    </head>
    <body>
        <p>
            <a href="http://www.baidu.com" target="_self" >跳转</a>
            <button onclick="fn()">打开窗口</button>
            <button onclick="clo()">关闭窗口</button>
            <button onclick='move()'>moveBy</button>
            <button onclick="to()">moveTo</button>
            <button onclick="prin()">print</button>
            <button onclick="scr()">scrollBy</button>
            <button onclick='scr1()'>scrollTo</button>
        </p>
        
        <div style="height:2000px;width: 1500px;"></div>
        <!--onclick鼠标单击事件-->
        <script>
            var New;
            function fn(){
                New=window.open('3.html','','width=400,height=500');
            }
            function clo(){
                New.close();
            }
            function move(){
                New.moveBy(100,100);//相对当前位置进行移动
            }
            function to(){
                New.moveTo(100,100);//相对于电脑屏幕左上角
            }
            function prin(){
                window.print();//打印窗口
            }
            function scr(){
                window.scrollBy(50,50);//按固定的值进行滚动
            }
            function scr1(){
                window.scrollTo(0,0);//直接滚到指定位置
            }
            /*
             bom:浏览器模型
             window
             navigator
             Screen
             History
             Location
             存储
             * */
            alert();//弹出警示框,带确定按钮
            prompt();//弹出输入框,带提示,输入,确定,取消,返回输入的值
            var res=confirm('你的浏览器该升级了,点击确认升级');//弹出询问框,带确定,取消,返回true和false
            console.log(res);
        </script>
    </body>
</html>
posted @ 2019-07-04 20:50  深夜的海洋  阅读(151)  评论(0编辑  收藏  举报