浏览器对象模型BOM

来源:互联网 发布:淘宝网红酒从哪进的 编辑:程序博客网 时间:2024/06/10 10:19

BOM为浏览器对象模型
BOM包括window对象,location对象,navigator对象,screen对象,history对象

window对象:
计时器:
setTimeout,setInterval,clearTimeout,clearInterval,requestAnimationFrame
location属性:
引用的是Location对象
属性:
protocol,href,host,port,search,hostname,pathname
方法:
replace()传入相对路径
reload()刷新页面
assign()链接到某个页面类似href,直接location='http://...'默认调用assign()方法
history属性:
引用的是history对象
属性:
length历史列表的元素的数量
方法:
back()向后
forward()向前
go(-1)跳转到上一个页面
navigator属性:
引用包含浏览器厂商和版本信息的Navigator对象
属性:
appName浏览器全称
appVersion浏览器版本
uerAgent 是http头部要发送的字符串
platform操作系统字符串
online是否在链接状态
geolocation
javaEnabled()
cookieEnable()
screen属性:
引用的是Screen对象,主要是提供窗口显示的大小和可用的颜色的数量的信息
属性:
availWidth(除任务栏之外的宽度),availHeight,colorDepth
对话框:
alert(str)
confirm(str)返回布尔值
prompt(str )返回字符串
showModalDialog()模态对话框
onerror属性:
是事件处理程序
元素的id属性值作为window对象的属性
打开和关闭窗口:
open(url,name,parmas,boolean)打开新的浏览器窗口,parmas是打开窗口的属性,boolean是打开的窗口是否替换当前历史条目
opener指打开新窗口的window对象,只有被打开的窗口有的属性
close()
parent属性:
引用包含它的窗口或窗体的window对象
iframe获取包含它的window对象:wd=iframe.contentWindow
wd.frameElement==iframe或者wd.frames[0]
top属性:
顶级窗口
原创粉丝点击