JS window 窗口的操作

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function funmoveby() {
            window.moveBy(-10, -10);
        }
        function funmoveto() {
            window.moveTo(10, 10);
        }
        function funresizeby() {
            window.resizeBy(20, 20);
        }
        //setInterval(funresizeby, 500);
        function funresizeto() {
            window.resizeTo(20, 20);
        }

        function fungetscreenleft() {
            alert(window.screenLeft);
        }
        function fungetscreenwidth() {
            alert(window.screen.width + "*" + window.screen.height);
        }
        var newwindow
        function funwindowopen() {
            newwindow = window.open('HTMLPage1.htm', '', 'left=100px,top=100px,width=500px,height=500px,resizable=no,scrollable=yes,toolbar=yes,status=yes,location=yes');
        }
        function funnewwindowlocation() {
            newwindow.location = 'http://www.baidu.com';
        }
        function funclosenewwindow() {
            newwindow.close();
        }
        function funmovetonewwindow() {
            newwindow.moveTo(100, 100);
        }
        function forward() {
            window.history.go(1);
        }
        function back() {
            window.history.go(-1);
        }
    </script>
</head>
<body>
<input id="Button11" type="button" value="前进" οnclick="forward();" /><br />
<input id="Button12" type="button" value="后退" οnclick="back();" /><br />
<a href="HTMLPage3.htm">跳转到page3</a>
    <input id="Button1" type="button" value="移动浏览器" οnclick="funmoveby();" />
    <br />
    <input id="Button2" type="button" value="移动浏览器到" οnclick="funmoveto();" />
    <br />
    <input id="Button3" type="button" value="调整浏览器大小" οnclick="funresizeby();" />
    <br />
    <input id="Button4" type="button" value="调整浏览器大小到" οnclick="funresizeto();" />
    <br />
    <input id="Button5" type="button" value="获取相对于浏览器左边缘的距离" οnclick="fungetscreenleft();" />
    <br />
    <input id="Button6" type="button" value="获取屏幕的宽和高" οnclick="fungetscreenwidth();" />
    <br />
    <input id="Button7" type="button" value="打开新窗体" οnclick="funwindowopen();" />
    <br />
    <input id="Button8" type="button" value="新窗体跳转到百度" οnclick="funnewwindowlocation();" />
    <br />
    <input id="Button9" type="button" value="关闭新打开的窗口" οnclick="funclosenewwindow();" />
    <br />
    <input id="Button10" type="button" value="调整新窗口的大小" οnclick="funmovetonewwindow();" />
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值