第四章 浏览器对象模型BOM
BOM:对浏览器进行访问和操作
基本BOM体系结构
window:
1、document(1、anchors 2、forms 3、images 4、links 5、location)
2、frames
3、history
4、location
5、navigator
6、screen
系统对话框:
confirm(“Are you sure?”)//返回Boolean,确定为true,取消为flash
prompt(“你的名字是什么?”, “Mike”)//"你的名字是什么?"为输入框提示,“Mike”为默认文本
时间间隔和暂停
所谓暂停是指在指定的毫秒数后执行指定的代码
时间间隔是指反复执行指定的代码,每次执行之间等待指定的毫秒数
setTimeout(“alert(‘Hello world!’)”, 1000);
历史
history.go(-1);
history.back();
//返回一页
history.go(1);
history.forward();
//前进一页
location对象
href---当前载入的页面的完整URL
window.location和document.location相互等价,可以交换使用。