话说后端38-BOM第一类
02:20源自LearningYard辅仁
那时小贴士为你增添flexsim应用软件采用的科学知识(4),
Shareinterests, spread happiness,
increaseknowledge, and leave beautiful!
Dearyou, this is LearningYard Academy.
Today,the editor brings you the knowledge of using flexsim software (38),
BOM提供了独立于内容 而与浏览器窗口进行交互的第一类;
由于BOM主要用于管理窗口与窗口之间的通讯,因此其核心第一类是window;(功能)
window是浏览器的内置第一类,里面包含着操作浏览器的方法
BOM由一系列相关的第一类构成,并且每个第一类都提供了很多方法与属性;
BOM缺乏标准,JavaScript语法的标准化组织是ECMA,DOM的标准化组织是W3C,BOM最初是Netscape浏览器标准的一部分。
What is BOM:
That is, BOM browser object model.
BOM provides objects that interact with browser windows independently of content;
As BOM is mainly used to manage the communication between windows, its core object is Window. (function)
Window is the built-in object of the browser, which contains the methods to operate the browser.
BOM is composed of a series of related objects, and each object provides many methods and attributes.
Lack of BOM standard, the standardization organization of JavaScript syntax is ECMA, the standardization organization of DOM is W3C, and BOM was originally a part of Netscape browser standard.
浏览器操作
操作浏览器跳转页面
操作浏览器的滚动条
明白浏览器的信息(浏览器的版本)
还有我们之前接触过的alert/prompt/comfirm
Browser operation
Get information about the browser (window size)
Operation browser jump page
Get the address bar information of the browser
Operate the scroll bar of the browser.
Understand the information of the browser (version of the browser)
And the alert/prompt/comfirm that we have contacted before.
BOM的采用
ow.innerWidth
alert()弹出层。
prompt()用户输入。
confirm()确定取消。
我们之后也会很少去采用弹出层,因为它会阻塞我们后面代码的执行。也不会设置它们的样式
Use of BOM
The two methods, innerWidth and innerHeight, get the width and height of the browser (including the scroll bar). window.innerWidth
Alert () popup layer.
Prompt () user input.
Confirm () Confirm to cancel.
After that, we will rarely use the pop-up layer, because it will block the execution of the code behind us. They are not styled either.
BOM的location第一类:location 是最有用的 BOM 第一类之一,提供了当前窗口中加载文档的信息,以及通常的导航所以我们将这个属性也称为 location 第一类。
Location object of BOM: location is one of the most useful BOM objects, which provides the information of documents loaded in the current window and the usual navigation functions. It is mainly about the acquisition and definition of browser url address related data. Window object provides us with a location property to get or set the URL of the form, and can be used to resolve the URL. Because this property returns an object, we also call this property location object.
可以采用decodeURIComponent(username[1]);来解决乱码问题
(类似于”
采用特点:URLSearchParams() 构造器 创建并返回一个新的URLSearchParams 第一类。 开头的’?’ 字符会被忽略。
When we go to get the parameters in the address bar, we usually use location.search to get? And what follows the question mark.
(similar to “? name=lc&age=20”)。 In this way, if we want to get the real parameters in the address bar, we need to intercept the? Cut it off. But we have URLSearchParams now.
Features: The URLSearchParams () constructor creates and returns a new URLSearchParams object. The beginning? The character will be ignored.
Thatsit for todays sharing.
If you have a unique idea about the article.
pleaseleave us a message.
I wish you a happy day today!
声明:本文由LearningYard新辅仁原创,如有侵权,请联系删除!