js中BOM相关知识

BOM(browser object module) :浏览器对象模型
BOM对象属性与方法
navigator :获取客户浏览器信息
    -navigator.appName;获取浏览器名称
screen :获取屏幕信息(高、宽)
    -screen.width :获取浏览器宽度
    -screen.height :获取浏览器高度
location :请求url地址
    -location.href :获取请求的url地址
    -location.href="" :设置url地址
history :请求的url的历史记录
    -history.back() :到访问的下一个页面
    -history.forward() :到访问的下一个页面
    -history.go(-1) :到访问的上一个页面
    -history·go(1) :到访问的下一个页面
window :js层级中的顶层对象
    窗口对象
    顶层对象(所用的bom都在window里面操作)
    属性
        window.opener :得到创建这个窗口的窗口
    方法
        -window.alert(message) (简写为alert())
        -confirm(message) 确认提示框  //返回flag
        确认flag = true 取消 flag = false
        -prompt(message1,message2) :输入对话框 //message1为提示词,message2为输入框内默认值
        -open("地址","","特征") :打开新的窗口 //地址为url,特征比如长和宽
        -close() :关闭窗口
        -setInterval(js代码,毫秒数) :每毫秒数执行一次js代码(定时器)
        -setTimeOut(js代码,毫秒数) :指定毫秒数之后执行一次(定时器)
        -clearInterval(id) :清除setInterval设置的定时器 //id为setInterval()的返回值   //var id = setInterval();
        -clearTimeOut(id) :清除setTimeOut设置的定时器 //id为setTimeOut()的返回值   //var id = setTimeOut();
原文地址:https://www.cnblogs.com/crazy-rock/p/13301714.html