JavaScript-BOM对象

BOM:使js有能力与浏览器“对话”

---------------------------------------------------

window对象:一个HTML文档对应一个window对象,用来控制浏览器窗口,直接使用,不需要生成对象。

window.alert()

var ret =window.confirm("hello world");

console.log(ret);

var ret =window.prompt("hello world");

console.log(ret);

open("baidu.com")

close()

setInterval(f,1000)  #f为函数名

---------------------------------------------

history对象:属于window子对象

history.back()

history.forward()

history.go(-1)

------------------------------

location对象:属于window对象

location.assign("baidu.com")  #链接到百度

location.reload()  #刷新F5

location.replace("baidu.com")   #覆盖原页面

--------------------------------------------------------

posted @ 2018-06-19 21:24  benchdog  阅读(131)  评论(0编辑  收藏  举报