BOM对象
浏览器对象模型(Browser Object Model),它提供了独立于内容与浏览器窗口进行交互的对象,使用浏览器对象可以实现HTML的交互,它的作用是将相关的元素组织包装起来,提供给程序设计人员使用,从而降低开发人员的劳动量,提高设计Web页面的能力。
BOM分层结构

window对象是整个BOM的核心,在浏览器中打开网页,首先看到的浏览器窗口,即顶层的windows对象,其次是document,它里面包括超链接、表单、锚等。
除了document对象以外,windows下还有二个重要对象:地址对(location)和历史对象(history)
BOM可实现的功能
(1) .弹出新的浏览器窗口
(2) .移动、关闭浏览器窗口以及调整窗口的大小
(3) .页面的前进、后退
嗯,以上知识点都是懵比。
windows对象的常用属性
属性列表

语法

案例演示:

Winows对象的常用方法

语法:

因为window对象是全局对象,所以在使用window对象的属性和方法,window可以省略。
confirm()与alert ()、 prompt()区别
alert( ):弹出消息,无返回值。
prompt( ):用来提示用户输入一些信息,取消按钮返回null,确定则返回用户输入的值。
confirm( ):显示提示对话框的消息、“确定”按钮和“取消”按钮,单击“确定”按钮返回true,单击“取消”按钮返回false,因此与if-else语句搭配使用,输出是个判断类型。
open方法
语法:
语法说明:

常用的事件

要是一开始弹出广告窗口,在body中用onload加function事件
例:<body onload="open_fix_adv">
open_fix_adv表示一个function函数
网友评论