search
HomeWeb Front-endFront-end Q&AWhat are the built-in objects of DOM?
What are the built-in objects of DOM?Dec 19, 2023 pm 03:45 PM
dombuilt-in objects

Dom built-in objects include: 1. document; 2. window; 3. navigator; 4. location; 5. history; 6. screen; 7. document.documentElement; 8. document.body; 9. document .head; 10. document.title; 11. document.cookie.

What are the built-in objects of DOM?

The operating system for this tutorial: Windows 10 system, DELL G3 computer.

DOM (Document Object Model) is an interface for representing and interacting with the structure of HTML or XML documents. It provides a set of built-in objects and methods. The following are some DOM built-in objects:

1. document: represents the entire HTML or XML document and is the root node of the DOM tree. It provides comprehensive access and manipulation of documents.

var doc = document; // Get the entire document object

2. Window: represents the browser window or frame and is a global object. It provides access to windows, documents and scripts.

var win = window; // Get the window object

3. Navigator: represents browser information, including browser name, version, operating system, etc.

var nav = navigator; // Get browser information object

4. Location: represents the URL information of the current document, including protocol, host, port, path, Query strings etc.

var loc = location; // Get the URL information object

5. History: represents the browser history, which can be used for forward, backward and jump operations.

var hist = history; // Get the browser history object

6. screen: represents the client screen information, including screen size, resolution, etc.

var scr = screen; // Get the screen information object

7. document.documentElement: represents the root element of the entire HTML document, that is, the element.

var root = document.documentElement; // Get the root element object

8, document.body: Represents the

element of the HTML document, which can be used Gets and sets the content of the element.

var body = document.body; // Get the

element object

9, document.head: Represents the

element of the HTML document, Can be used to get and set the content of the element.

var head = document.head; // Get the

element object

10. document.title: represents the title of the HTML document, which can be obtained through it and set the title of the document.

var title = document.title; // Get the document title object

document.title = "New Title"; // Set the document title to "New Title"

11. document.cookie: represents the cookie information stored by the browser, through which the cookie value can be read and set.

var cookie = document.cookie; // Get the cookie information object

document.cookie = "name=value"; // Set the cookie value to "name=value"

These are some common built-in objects in the DOM that provide access to and manipulation of the HTML or XML document structure. By using these objects and methods, developers can dynamically change the content and style of the page, interact with the user, and process browser-related information.

The above is the detailed content of What are the built-in objects of DOM?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Vue3获取DOM节点的方式有哪些Vue3获取DOM节点的方式有哪些May 11, 2023 pm 04:55 PM

1.原生js获取DOM节点:document.querySelector(选择器)document.getElementById(id选择器)document.getElementsByClassName(class选择器)....2.vue2中获取当前组件的实例对象:因为每个vue的组件实例上,都包含一个$refs对象,里面存储着对应的DOM元素或组件的引用。所以在默认情况下,组件的$refs指向一个空对象。可以先在组件上加上ref="名字",然后通过this.$refs.

vue内置对象有哪些vue内置对象有哪些Nov 08, 2023 pm 04:52 PM

vue内置对象有Vue、Vue实例、data、el、options、parent、root、children、slots、scopedSlots、refs、isServer、attrs和listeners。Vue.js是一个用于构建用户界面的渐进式JavaScript框架。在Vue.js中,有一些内置对象或全局API,这些对象和API可以用于创建和管理Vue应用程序。

PHP中的DOM操作指南PHP中的DOM操作指南May 21, 2023 pm 04:01 PM

在网页开发中,DOM(DocumentObjectModel)是一个非常重要的概念。它可以让开发者轻松地对一个网页的HTML或XML文档进行修改和操作,比如添加、删除、修改元素等。而PHP中内置的DOM操作库也为开发者提供了丰富的功能,本文将介绍PHP中的DOM操作指南,希望可以帮助到大家。DOM的基本概念DOM是一个跨平台、独立于语言的API,它可以将

vue dom是什么意思啊vue dom是什么意思啊Dec 20, 2022 pm 08:41 PM

dom是一种文档对象模型,同时也是用于html编程的接口,通过dom来操作页面中的元素。DOM是HTML文档的内存中对象表示,它提供了使用JavaScript与网页交互的方式。DOM是节点的层次结构(或树),其中document节点作为根。

asp内置对象有哪些asp内置对象有哪些Nov 09, 2023 am 11:32 AM

asp内置对象有Request、Response、Session、Application、Server、Session.Contents、Application.Contents、Server.CreateObject、Server.MapPath、Server.Execute、Server.Transfer等。详细介绍:1、Request:表示HTTP请求对象等等。

Python内置对象都有哪些Python内置对象都有哪些Nov 08, 2023 am 10:19 AM

Python内置对象有“int”、“float”、“str”、“list”、“tuple”、“dict”、“set”、“bool”、“NoneType”和“function”等十种:1、int,用于表示整数值;2、float,用于表示实数值;3、str,用于表示文本数据;4、list,用于存储一系列有序的元素;5、tuple,元组类型;6、dict,用于存储键值对的数据结构等。

vue3中ref绑定dom或组件失败的原因是什么及怎么解决vue3中ref绑定dom或组件失败的原因是什么及怎么解决May 12, 2023 pm 01:28 PM

vue3ref绑定dom或者组件失败原因分析场景描述在vue3中经常用到使用ref绑定组件或者dom元素的情况,很多时候,明明使用ref绑定了相关组件,但是经常ref绑定失败的情况。ref绑定失败情况举例ref绑定失败的绝大多数情况是,在ref和组件绑定的时候,该组件还未渲染,所以绑定失败。或者组件刚开始未渲染,ref未绑定,当组件开始渲染,ref也开始绑定,但是ref和组件并未绑定完成,这个时候使用组件相关的方法就会出现问题。ref绑定的组件使用了v-if,或者他的父组件使用了v-if导致页面

nodejs 有哪些内置对象nodejs 有哪些内置对象Nov 07, 2023 pm 03:33 PM

nodejs内置对象有Global、Process、Buffer、Console、Timer、EventEmitter、Stream、File System、HTTP、URL、Query String、Crypto、Path、OS等。详细介绍:1、Global:全局对象,类似于浏览器环境中的window对象,可以在任何地方访问;2、Process等等。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!