javascript: The Browser Object Model(BOM)

window

  • window对象是浏览器或者框架自身.top总是浏览器,parent是父框架,self表示自己. window通常可以省略.
  • 窗口操作: moveBy(dx, dy), moveTo(x, y), resizeBy(dw, dh), resizeTo(w, h).
  • 导航: window.open(url, frame name, attribute). attribute可以是left, top, height, width, resizable, scrollable, toolbar, status, location(all default no). 
    • window.open 返回新窗口引用,并且有一个opener对象表示父窗口
    • window.close.
  • 对话框: alert, confirm, prompt.
  • 状态栏: window.status, window.defaultStatus
  • 时 间间隔和暂停: timeoutId = setTimeout("alert('hello world')", 1000); clearTimeout(timeoutId);类似有setInterval和clearInterval.
  • 历史: window.history.go(+-n), history.back, history.forward. history.length

document

  • alert(window.document == document) == true. 他是唯一一个既属于DOM又属于BOM的对象
  • 属性:title, URL, referrer, lastModified
  • 集合属性: anchors, applets, embeds, forms, images, links.
  • 方法: write, writeln. 必须在完全载入页面前调用write()和writeln()方法. 如果任何一个方法是在页面载入后调用的,它将抹去页面的内容,显示指定的内容.

location

  • window和 document的属性,相互等价.
  • 属性: hash(位于#后面的东西), host, hostname, href, pathname, port, protocol, search(位于?后面的东西).
  • 方法: assign(), replace(), reload(false=从缓存中导入(default),true=从服务器端导入)

navigator和 screen对象

  • navigator对象表示了浏览器本身,可以获取一些属性,但是各个浏览器支持不同.
  • screen 对象可以得到用户系统的信息,如availHeight, availWidth(可用屏幕宽度和高度,排除了系统任务栏), colorDepth, height, width.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

帅帅兔子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值