当前位置:网站首页>BOM文档
BOM文档
2022-06-26 05:27:00 【程序员的朴实无华】
1.BOM的概念
BOM(Browser Object Model) 是指浏览器对象模型,浏览器对象模型提供了独立于内容的、可以与浏览器窗口进行互动的对象结构。BOM由多个对象组成,其中代表浏览器窗口的Window对象是BOM的顶层对象,其他对象都是该对象的子对象。
2.BOM的顶级对象window,当调用window下的属性和方法可以省略window。
3.页面加载事件
onload属性
window.onload = function () {
// 当页面加载完成执行
// 当页面完全加载所有内容(包括图像、脚本文件、CSS 文件等)执行
}
onunload属性
window.onunload = function () {
// 当用户退出页面时执行
}
4.定时器
setTimeout()和clearTimeout()
在指定的毫秒数到达之后执行指定的函数,只执行一次。
// 创建一个定时器,1000毫秒后执行,返回定时器的标示
var timerId = setTimeout(function () {
console.log('Hello World');
}, 1000);
// 取消定时器的执行
clearTimeout(timerId);
setInterval()和clearInterval()
定时调用的函数,可以按照给定的时间(单位毫秒)周期调用函数
// 创建一个定时器,每隔1秒调用一次
var timerId = setInterval(function () {
var date = new Date();
console.log(date.toLocaleTimeString());
}, 1000);
// 取消定时器的执行
clearInterval(timerId);
5.location对象
location对象是window对象下的一个属性,时候的时候可以省略window对象
location可以获取或者设置浏览器地址栏的URL
6.URL
统一资源定位符 (Uniform Resource Locator, URL)
URL的组成
scheme://host:port/path?query#fragment
scheme:通信协议
常用的http,ftp,maito等
host:主机
服务器(计算机)域名系统 (DNS) 主机名或 IP 地址。
port:端口号
整数,可选,省略时使用方案的默认端口,如http的默认端口为80。
path:路径
由零或多个'/'符号隔开的字符串,一般用来表示主机上的一个目录或文件地址。
query:查询
可选,用于给动态网页传递参数,可有多个参数,用'&'符号隔开,每个参数的名和值用'='符号隔开。例如:name=zs
fragment:信息片断
字符串,锚点.
location有哪些成员?
使用chrome的控制台查看
assign()/reload()/replace()
hash/host/hostname/search/href……
7.history对象
back()
forward()
go()
8.navigator对象
userAgent
通过userAgent可以判断用户浏览器的类型
platform
通过platform可以判断浏览器所在的系统平台类型
边栏推荐
- Protocol selection of mobile IM system: UDP or TCP?
- 程序人生
- cartographer_ optimization_ problem_ 2d
- Classic theory: detailed explanation of three handshakes and four waves of TCP protocol
- Setting pseudo static under fastadmin Apache
- Internship May 29, 2019
- How to make your big file upload stable and fast?
- Redis discovery bloom filter
- 【MYSQL】MySQL 百万级数据量分页查询方法及其优化
- As promised: Mars, the mobile terminal IM network layer cross platform component library used by wechat, has been officially open source
猜你喜欢
Could not get unknown property ‘*‘ for SigningConfig container of type org.gradle.api.internal
redis探索之布隆过滤器
[arm] add desktop application for buildreoot of rk3568 development board
Practical cases | getting started and mastering tkinter+pyinstaller
cartographer_optimization_problem_2d
Supplementary course on basic knowledge of IM development (II): how to design a server-side storage architecture for a large number of image files?
Create SSH key pair configuration steps
ECCV 2020 double champion team, take you to conquer target detection on the 7th
cartographer_ local_ trajectory_ builder_ 2d
Technical past: tcp/ip protocol that has changed the world (precious pictures, caution for mobile phones)
随机推荐
Baidu API map is not displayed in the middle, but in the upper left corner. What's the matter? Resolved!
Recursively traverse directory structure and tree presentation
Keras actual combat cifar10 in tensorflow
The difference between get and post in small interview questions
Codeforces Round #800 (Div. 2)
As promised: Mars, the mobile terminal IM network layer cross platform component library used by wechat, has been officially open source
First day of deep learning and tensorflow learning
SOFA Weekly | 开源人—于雨、本周 QA、本周 Contributor
线程优先级
Data storage: the difference between MySQL InnoDB and MyISAM
Uni app ceiling fixed style
Leetcode114. 二叉树展开为链表
Leetcode513.找出树的左下角的值
2021年OWASP-TOP10
《财富自由之路》读书之一点体会
cartographer_ pose_ graph_ 2d
Red team scoring method statistics
ZigBee learning in simple terms Lecture 1
【MYSQL】MySQL 百万级数据量分页查询方法及其优化
[arm] build boa based embedded web server on nuc977