DHTML Object Model (About The DHTML Object Model) (1)

zhaozj2021-02-16  69

[Note: Recently I have learned ASP.NET, I feel that many of JavaScript is still useful in ASP.NET, and I think that JavaScript is used to program the script to DHTML objects, but online about the Chinese tap of DHTML hierarchy.  Key stamp? SPAN lang = en-us> After this information on MSDN, he translated it, I hope everyone will advise. 】

DHTML Object Model (About The DHTML OBJECT Model)

Dynamic HTML (DHTML) Document Object Model (DOCUMENT OBJECT MODEL: DOM) enables webpage makers to access each individual part on the web document in programmable, regardless of whether the elements are or containers. This way of access includes event models, and event model allows the browser to react to user input. By performing scripts, it is not necessary to download a new page from the server to display new content according to user input. Dynamic HTML Document Object Model (DHTML DOM) provides a wealth of web interactions for the majority of ordinary web makers in a convenient way.

· What is an object model? (What is the object model?)

· Use script access elements (Accessing Elements with Script)

· Event: bubbling, prohibition and processing (Events: bubbling, canceling, and handling)

· Handling Rollover Effects

· No events (Canceling Events)

· Further think (Special Considance)

· Related Topics

What is an object model?

The object model is a programmable structure that makes DHTML, it does not require webpage makers to learn any new HTML tags, which do not involve any new web page production technology. In fact, in fact, this object model is a web page production technology based on web crew's past have been habits. Recall that you have tried using the script to set the value of the form (form) element, or use the script to add a Mouseover event for the link in a Microsoft IE3.0 browser; if so, you are already using script A limited form of the DHTML object model to access your HTML webpage.

The only difference between this DHTML object model is now: Now, any HTML element is programmable. This means that any of the HTML elements on the page can have the corresponding script, which can use these script code to interact with the user's actions, dynamically change the page content. Such an event model allows the document to make some action on the user (for example, when the user moves the mouse pointer to a specific element, or pressing the keyboard button, or entering a new form in the form. After the information, it makes a corresponding reaction. Each event can be linked to a script to tell the browser how to change the content in this interaction without returning the server to get a new file. The benefit of this is that web creators can create rich interactive code with fewer pages. The viewer of the web page is downloaded from the website from the website from the website without waiting for a new page, regardless of the browsing speed to the browsing effect.

Use script access elements

Each HTML element in an object model is an object that can be written scripts, with its own set of properties, methods, and events. To write scripts for element objects, web producers must first know how to get an object. The focus of DHTML is a collection of elements, as well as how these elements are organized into a hierarchy. The most important thing in these elements is the All Collection and Children Collection. A DHTML document is a set of structured elements that each element has its own impact in the following example, which depends on the position that appears in the document.

some text in a

Paragraph

In the above example, the DIV object contains a P object and an IMG object called Image1, and the parent of these two objects, the relative P object and the IMG object are children of the Div object. The IMG object called Image2 is a child of a body object.

Each element object has a collection of objects called all and a collection of Children. All object sets containing all objects under this element hierarchy, while the Children object set contains all direct children of current elements. element. In the above example, b is in the ALL set of the DIV object, but does not appear in the Children collection of the DIV object; in the same manner, the DIV object is a member of the Body Object Children collection, and the P object is not.

Each element except that the document (represented by document) itself has a series of elements and non-element collections itself, and the most important set is all the set, which contains all the current web pages. Elements, this collection is the most basic way for scripting language access element objects. For more information on the collection of elements objects, see "Scripting with Elements and Collectes"

转载请注明原文地址:https://www.9cbs.com/read-13002.html

New Post(0)