众所周知,window 对象是 BOM 的核心,用来表示当前浏览器窗口,其中提供了一系列用来操作或访问浏览器的方法和属性。另外,JavaScript 中的所有全局对象、函数以及变量也都属于 window 对象,甚至我们前面介绍的 document 对象也属于 window 对象。
JSON语法:
JSON.stringfy(); JS变成JSON格式
JSON.parse(); JSON变为JS格式
全局样式:
.getComputedStyle();
本地存储:
localStorage.setItem('存储对象',类型);
localStrorage.getItem();
localStrorage.removeItem('');删除本地存储对象
自定义属性:
.setAttribute('属性名','值');
.removeAttribute();
窗口:
window.open('','','','');
.close();
.focus();
.moveTo();
.resizeTo();
历史记录:
history.back();
history.forward('');去到某个页面
history.go(); 1, 2