版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cxh6863/article/details/83244911
1、window对象
document
获取对象事件
//这俩种方式相同
window.document.getElementById("###");
document.getElementById("###");
onload
加载事件
//这俩种方式相同
window.onload=function(){alert("烽火佳人");};
onload=function(){alert("烽火佳人");};
2、confirm
确认事件
window.confirm("测试消息,请选择");
3、location
定位事件
location.href="路径";
//返回web主机的域名
location.hostname
//返回当前页面的路径和文件名
location.pathname
//返回web主机的端口
location.port
//返回所使用的web协议
location.protocol
4、screen
屏幕分辨率事件
screen.width
screed.height
5、history
//返回
history.back();
//向前
history.forward();
6、window尺寸
//浏览器窗口的内部高度
window.innerHeight
//浏览器窗口的内部宽度
window.innerHeight
7、其他
//打开新窗口
window.open()
//关闭当前窗口
window.close()
//移动当前窗口
window.moveTo
//调整当前窗口的尺寸
window.resizeTo()