Xiao KeeExpand on the basis of DOM1, introduce more interactions, and process more advanced XML. It is divided into many application modules, describing the functions of DOM2 and DOM3, including: DOM2-level core, DOM2-level view, DOM2-level event (13 chapters), DOM2-level st
Guidance:
So far, the event processing technology in this chapter is part of the dom0 level, and all browsers that support JavaScript support the dom0 API. dom2 defines an advanced event processing API, which is significantly different from the dom0 API (and more powerful ). although the dom2 standard does not generate an existing API, The dom0-level API is not removed. for basic event processing tasks, you
Differences between dom0-level events and dom2-level events in JS, dom0dom2
Dom0-level events
For example, if the onclick is written in the tag above, all events are dom0-level events, and fn and fn1 are executed in sequence. The second method obtains elements and binds the onclick event to dom0-level events. The second method overwrites the first onclick event, it will also overwrite the onclick in the row, and only 222 will pop up.
Js learning Summary-dom2-level basic knowledge, jsdom2
The DOM2 event binding we use actually enables the box to always find the addEventListener method on the EventTarget built-in class prototype through the prototype chain.
DOM0-level event binding: only one action of an element can be bound to a method once. The second binding will overwrite the previous one.
DOM2
This article mainly introduces the differences between dom0-level events and dom2-level events in JS, which are of great reference value. I would like to share with you the script home platform for your reference.
Dom0-level events
Go back to above to activateVar btn = $ ('# hash '). get (); btn. onclick = function () {alert ('') ;}; btn. onclick = function () {alert ('');};
For example, if the onclick is written in the tag above, all events are d
Dom0 Level Event
Like above the onclick written in the label, are dom0-level events, FN and fn1 in turn to execute; The second gets the element, the binding onclick event is also the DOM0 level, the second overrides the first onclick, and it overwrites the onclick in the row, which only pops up 222.
Dom2 Level Event
$ (' #hash '). Click (function () {
alert (' Dom2-click First time ')
1. DOM2 and DOM3The DOM2 level specification defines modules that are used to enhance the DOM1 level. "DOM2-Level core" introduces some XML namespace-related methods for different DOM types, which are only used in XML or XHTML and have no practical meaning for HTML documents. In addition to the methods associated with XML namespaces, the
DOM2 level EventsSeveral types of events:object events, mouse events, keyboard events, form events, W3cdom events, and browser-specific events.Object events:The Window object, which is also a JavaScript object.Load applies to the Window object, and all image files required by the page are loaded for completion before triggering.The Unload applies to the Window object, capturing the last instant of information before the page is closed.Error applies to
= "BTN2"> Script> varbtn2=document.getElementById ("btn2"); Btn2.onclick= function() {Console.log ( This); } Script> Body>HTML>The result of the this output is: this in the Dom0 level event handler refers to the current element itself , Instead of windows, you can access any attribute and any method of the element through this. 3.dom2 Level Event handlersThe DOM2 level event defines
(Browser object model) and the DOM (Document Object model). You can adjust the width, height, and location of your browsing through JavaScript, and you can adjust the display, hiding, form submission, etc. of Web page content through JavaScript.
2. The birth and development of Dom 2.1 dom is what
DOM, Document Object model. DOM is the standard for the World Wide Web Consortium, which defines the criteria for accessing HTML and XML documents. In the standard of the consortium, Dom is a platform-
Full-stack JavaScript (24) DOM2 and DOM3, which do not involve XML namespace extension, dom2dom3
(1) three attributes are added to the DocumentType change: publicId, systemId, and internalSubset (internal subset)
You can access the file by using document.doctype.publicId,document.doctype.systemId,document.doc type. internalSubset.
Export document.doc type. internalSubset will get "
(2) importNode () method, which is unrelated to xml naming, is u
There are three methods to define styles in HTML: Use the lt; link gt; label to reference an external style table file, and use lt; style gt; element to define embedded styles and use the style feature to set styles for specific elements. The "DOM2-level style" module is a set of Apis around these three application style mechanisms. To determine whether the browser supports DOM2-level CSS capabilities,
I will share with you today the elevation, Version 2, chapter 11, dom2, and dom3
Throughout this chapter, Dom is changing, and changing in the future.
However, ie does not support dom2 or dom3. In the future, some new versions may support dom2 or dom3.
It is not common to select text, copy and select text. Probably skipped.
Mainly useful, there are severa
inherited from a parent element.Toggle style based on classnameClassName refers to the class property of the HtmlElement object.Why not set the Class property setattribute?Element.setattribute (' class ', ' name ');IE element.setattribute (' className ', ' name ');Toggle Style Sheet1. You can use the Rel attribute of the 2. Apply a class name to the body tag3. Add or Remove style sheetsProperties of the TypeHrefMediaRel "stylesheet" immediately applies "alternate stylesheet" standbyDisabled is
DOM2:1. DOM2: Create a complete HTML documentDocument.implementation.createHTMLDocument ("New Doc");alert (htmldoc.title);------"New Doc"Alert (typeof htmldoc.body);-----"Object"2. Style:1) in CSS property is Color,background-image, in JS Style.color,style.backgroundimageFloat is a reserved word in JS, it cannot be used as a property name, the Style object is cssfloat, and in IE it is stylefloatvar A=docume
Js learning Summary: How to Solve repeated problems in DOM2 compatibility, jsdom2
DOM2 compatibility solves repeated problems as follows:
After solving this problem, you only need to make a judgment every time you add an event to the custom attribute and event pool. The specific code is as follows:
/* Bind: compatibility problem (binding method) for DOM2-level ev
Full-stack JavaScript path (23) DOM2 and DOM3, involving XML namespace extension (1), dom2dom3
The preceding example shows how to use xmlns to specify a namespace and use xmlns: prefix to specify a prefix. Once a prefix is specified, it must be used for the current element and child element.
Sometimes, to avoid conflicts between different languages, you also need to use namespaces to limit features, as shown in the following example.
(1) Node t
Solve the order problem: We do not use the browser to bring the event pool, but the self-simulation of the standard browser event pool implementation, the code is as follows:/*bind: Handling compatibility issues with DOM2-level event bindings (binding methods) @parameter:curele-> The element to bind the event to eventype-> the type of event to bind ("click", "Mouse Over ") evenfn-> the method to bind*/functionbind (CURELE,EVENTYPE,EVENFN) {if(' AddEve
Change of node type
Accessing the style of an element
MyDiv.style.backgroundColor = "Red" myDiv.style.width = "100px"
The calculated style
Remember that all computed styles are read-only
Offset amount
offsetheight outer border outside offsetwidth offsetleft outside box to left side offsettop
Size of Customer Area
clientwidth inner border outer edge clientheight inner border outer edge
Scrolling size
and onmouseout EventsThe onmouseover and onmouseout events can be used to trigger a function when a user moves the mouse over an HTML element or moves out of an element.InstanceA simple example of onmouseover-onmouseout: DOCTYPE HTML>HTML> Body> Divonmouseover= "MOver (this)"onmouseout= "Mout (this)"style= "Background-color: #D94A38; width:200px;height:50px;padding-top:25px;text-align:center;">Mouse over MeDiv> Script> functionmOver (obj) {obj.innerhtml="Thank you"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.