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

    亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

    element. <\/p>\n

    var body = document.body; \/\/ Get the element object <\/p>\n

    9, document.head: <\/strong>Represents the element of the HTML document, Can be used to get and set the content of the element. <\/p>\n

    var head = document.head; \/\/ Get the element object <\/p>\n

    10. document.title: <\/strong> represents the title of the HTML document, which can be obtained through it and set the title of the document. <\/p>\n

    var title = document.title; \/\/ Get the document title object <\/p>\n

    document.title = \"New Title\"; \/\/ Set the document title to \"New Title\"<\/p>\n

    11. document.cookie: <\/strong> represents the cookie information stored by the browser, through which the cookie value can be read and set. <\/p>\n

    var cookie = document.cookie; \/\/ Get the cookie information object <\/p>\n

    document.cookie = \"name=value\"; \/\/ Set the cookie value to \"name=value\" <\/p>\n

    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. <\/p>"}

    Home Web Front-end Front-end Q&A What are the built-in objects of DOM?

    What are the built-in objects of DOM?

    Dec 19, 2023 pm 03:45 PM
    dom built-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 of this Website
    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

    Hot AI Tools

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    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.

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Hot Topics

    PHP Tutorial
    1488
    72
    What are the ways to obtain DOM nodes in Vue3 What are the ways to obtain DOM nodes in Vue3 May 11, 2023 pm 04:55 PM

    1. Native js gets the DOM node: document.querySelector (selector) document.getElementById (id selector) document.getElementsByClassName (class selector).... 2. Get the instance object of the current component in vue2: because each vue Each component instance contains a $refs object, which stores references to the corresponding DOM elements or components. So by default, the component's $refs point to an empty object. You can first add ref="name" to the component, and then pass this.$refs.

    What does vue dom mean? What does vue dom mean? Dec 20, 2022 pm 08:41 PM

    DOM is a document object model and an interface for HTML programming. Elements in the page are manipulated through DOM. The DOM is an in-memory object representation of an HTML document, and it provides a way to interact with web pages using JavaScript. The DOM is a hierarchy (or tree) of nodes with the document node as the root.

    What is the reason why ref binding to dom or component fails in vue3 and how to solve it What is the reason why ref binding to dom or component fails in vue3 and how to solve it May 12, 2023 pm 01:28 PM

    Vue3ref binding DOM or component failure reason analysis scenario description In Vue3, it is often used to use ref to bind components or DOM elements. Many times, ref is clearly used to bind related components, but ref binding often fails. Examples of ref binding failure situations The vast majority of cases where ref binding fails is that when the ref is bound to the component, the component has not yet been rendered, so the binding fails. Or the component is not rendered at the beginning and the ref is not bound. When the component starts to render, the ref also starts to be bound, but the binding between ref and the component is not completed. At this time, problems will occur when using component-related methods. The component bound to ref uses v-if, or its parent component uses v-if to cause the page to

    What are the dom and bom objects? What are the dom and bom objects? Nov 13, 2023 am 10:52 AM

    There are 5 DOM objects including "document", "element", "Node", "Event" and "Window"; 2. "window", "navigator", "location" and "history" and "screen" and other 5 BOM objects.

    What are the built-in objects in asp? What are the built-in objects in asp? Nov 09, 2023 am 11:32 AM

    ASP built-in objects include Request, Response, Session, Application, Server, Session.Contents, Application.Contents, Server.CreateObject, Server.MapPath, Server.Execute, Server.Transfer, etc. Detailed introduction: 1. Request: represents HTTP request object, etc.

    What are the built-in objects in Python? What are the built-in objects in Python? Nov 08, 2023 am 10:19 AM

    There are ten types of Python built-in objects: "int", "float", "str", "list", "tuple", "dict", "set", "bool", "NoneType" and "function": 1. int , used to represent integer values; 2. float, used to represent real values; 3. str, used to represent text data; 4. list, used to store a series of ordered elements; 5. tuple, tuple type; 6 , dict, a data structure used to store key-value pairs, etc.

    DOM manipulation guide in PHP DOM manipulation guide in PHP May 21, 2023 pm 04:01 PM

    In web development, DOM (DocumentObjectModel) is a very important concept. It allows developers to easily modify and operate the HTML or XML document of a web page, such as adding, deleting, modifying elements, etc. The built-in DOM operation library in PHP also provides developers with rich functions. This article will introduce the DOM operation guide in PHP, hoping to help everyone. The basic concept of DOM DOM is a cross-platform, language-independent API that can

    What is the difference between bom and dom What is the difference between bom and dom Nov 13, 2023 pm 03:23 PM

    BOM and DOM are different in terms of role and function, relationship with JavaScript, interdependence, compatibility of different browsers, and security considerations. Detailed introduction: 1. Role and function. The main function of BOM is to operate the browser window. It provides direct access and control of the browser window. The main function of DOM is to convert the web document into an object tree, allowing developers to Use this object tree to obtain and modify the elements and content of the web page; 2. Relationship with JavaScript, etc.

    See all articles