JavaScript 浏览器对象

bom 把浏览器看成一个对象,是操作浏览器

dom是操作浏览器的内容

 

页面的文档对象
console.log(window.document);
浏览器的框架
console.log(window.frames);
浏览器的信息
console.log(window.navigator);
屏幕的信息
console.log(window.screen);

href属性 控制浏览器地址内容
reload 刷新页面
reload(true) 刷新页面,不带缓存
assign 加载新的页面
replace() 加载新的页面不会在历史记录留下记录
connsole.log(window.locationn);
console.log(window.history);


======================================================
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="js/test.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<button>按钮</button>
<button onclick="func()">跳转到红页面</button>



</body>
</html>


================================
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="js/test.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<button>按钮</button>
<button onclick="func()">跳转到红页面</button>



</body>
</html>


================================
function func(){
console.log("点我干嘛")
// 跳转到red。html
// window.location.href = "red.html"
// window.location.reload()
window.location.assign("red.html")
}
console.log(window.document);
console.log(window.frames);
console.log(window.navigator);
console.log(window.screen);
console.log(window.locationn);
console.log(window.history);
console.log(window,location)
















posted @ 2018-12-19 23:06  freeengles  阅读(151)  评论(0编辑  收藏  举报