js之window

1.获得窗口的位置

 var left = window.screenLeft || window.screenX;
 var top = window.screenTop || window.screenY;

2.获得窗口的大小

 var width = document.documentElement.clientWidth || document.body.clientWidth;
 var height = document.documentElement.clientHeight || document.body.clientHeight;

3.窗口的打开和关闭

   var window1 = window.open("http://www.baidu.com",
            "_blank",
            "height=400,width=400,top=10,left=10,resizable=yes");
        window1.close();

4. 超时调用 setTimeOut(fn,500)

5.间隔调用 setInterval(fn,500)

清除间隔调用

int timer = setInterval(fn,500);

clearInterVal(timer);rrrr5f

6.系统对话框

alert('hello world!');

confirm('Are you sure?');  确认框

prompt('Are you sure?','Michael'); 提示框

猜你喜欢

转载自www.cnblogs.com/xiaoxinstart/p/12588301.html
今日推荐