Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the javascript document object model

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what is the javascript document object model". In daily operation, I believe many people have doubts about what the javascript document object model is. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the questions of "what is the javascript document object model?" Next, please follow the editor to study!

The javascript document object model is a tree. Document object Model (DOM) is a standard programming interface recommended by W3C to deal with extensible markup language. It is a tree-based API document.

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

In javascript, the document object model is a tree.

Document object Model (Document Object Model, referred to as DOM) is a standard programming interface recommended by W3C to deal with extensible markup language (DOM). It is a kind of API document based on tree.

Document: a real file such as a web page file (HTML text)

Object: a separate set of data, such as a data set of elements and contents in a document.

Model: document objects are represented as tree models. In this tree model, the elements and content of a web page are represented as nodes.

Properties of the Window object:

Parent:

Parent window object, which has the same meaning as the parent window that contains a window. Self: this window has the same meaning as referring to the current window. Top: refers to an array of all frame objects contained in the uppermost browser window frames: window object in a series of nested windows. Document: represents the current document object displayed in the window history: the history object of the window Contains the URL list recently accessed in the window location: represents the URL address associated with the window object event: window event object (Only for IE) name: window name opener: represents the window window object defaultStatus: window status bar default status: window status bar display information navigator: used to get browser information appName "Netscape" for Mozilla "Microsoft Internet Explorer" for IE

Window object method

Alert (): warning dialog box

Confirm (): confirm dialog box

Prompt (): information input dialog box

Close (): close the window

Blur (): the window loses focus

Focus (): the window gets focus

Open (): open a new window and create a new window object

ShowModalDialog (): opens a modal dialog box

ShowModelessDialog (): opens a modeless dialog box

The dialog box gets the passed parameters through window.dialogArguments

The dialog box returns information to the window that opens the modal dialog box through window.returnValue, and you can return an object to prevent the opening of a new window (such as submitting a form):

Properties of the document object

Title: sets the document title, which is equivalent to the tag of HTML

BgColor: sets the background color of the page, corresponding to the bgcolor property in

FgColor: sets the front color of the page, corresponding to the text attribute in the tag

AlinkColor: sets the color of the active link (focus on this link)

LinkColor: sets the color of unclicked links

VlinkColor: sets the color of the link that has been clicked

URL: URL forms of the document: an array of form objects, corresponding to tags

Links: an array of linked objects, with tags that should have href attributes

Anchors: an array of anchor objects, with tags that should have name attributes

Images: an array of picture objects, corresponding to

Marking

Methods of document object

Close (): used to close windows other than the current window

Write (): dynamically writes content to the page

GetElementById (): the object that gets the specified ID value

GetElementsByName (): an object that gets the specified name value and returns an array

GetElementsByTagName ("tr"): gets the object of the specified TagName and returns an array

CreateElement (): creates the specified HTML tag object var obj = createElement ("input")

History object

Attribute

Current: the URL of the document currently displayed in the window

Method

Back (): loads the previous page in the history table, which is equivalent to clicking the browser's back button

Forward (): loads the next page in the history table, which is equivalent to clicking the forward button on the browser

Go (string): loads the most recent document in the history table where the URL string contains this substring

Go (n): when n > 0, the nth document in the history table is loaded; when n > 0, the current document is loaded; n

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report