DOM operations are a key part of learning Javascript. YUI provides rich DOM operation interfaces defined in % BUILD % domdom. js (encapsulated as YAHOO. util. Dom ). Since DOM operations are important, I plan to divide them into several parts for analysis. Bypass A Lot Of if
);}, SetStyle: function (el, property, val ){Property = toCamel (property );// Set the node StyleVar f = function (element ){SetStyle (element, property, val );};Y. Dom. batch (el, f, Y. Dom, true );}. For more information about the usage of these two functions, see the relevant documentation. In fact, it is easy to understand how to use parameters. The above two functions help to understand the call metho
Bypass A Lot Of if... else (actually defining the tocamel and getstyle functions) in the header first.-The browser implementation is not uniform, causing such a problem. You can talk about it later.
Code .
Next we will look at the treasures in the Yahoo. util. Dom class. At present, the idea has been gradually split. I have seen a function.
// Basically, it can be considered as a revision of document
The getXY function in YAHOO. util. Dom allows developers to fully experience the Hack of different browsers. IE8 is about to break out of the shell. I hope the following functions won't be judged by multiple if statements. The getXY function uses an anonymous function to execute the return function (it sounds a bit tricky. refer to an article on the Blog of the center of the circle ). Var getXY = function (
Bypass A Lot Of if... else (actually defining the toCamel and getStyle functions)-the implementation of the browser is not uniform, causing such a problem. You can talk about the code later.Next we will look at the treasures in the YAHOO. util. Dom class. At present, the idea has been gradually split. I have seen a function.// Basically, it can be considered as a revision of document. getElementByIdGet: fun
Var patterns = {HYPHEN:/(-[a-z])/I,ROOT_TAG:/^ body | html $/I};Var toCamel = function (property ){// If no-[a-z] letter exists, return directlyIf (! Patterns. HYPHEN. test (property )){Return property;}// If there is a cache, the replaced value is directly returned.If (propertyCache [property]) {Return propertyCache [property];}// Use regular expression replacementVar converted = property;While (patterns.HYPHEN.exe c (converted )){Converted = converted. replace (RegExp. $1,RegExp. $1. substr (1
VaR patterns = {
Hyphen:/(-[A-Z])/I,
Root_tag:/^ body | HTML $/I
};
VaR tocamel = function (property ){// If no-[A-Z] letter exists, return directlyIf (! Patterns. hyphen. Test (property )){Return property;}
// If there is a cache, the replaced value is directly returned.If (propertycache [property]) {Return propertycache [property];}
// Use regular expression replacementVaR converted = property;While (patterns.hyphen.exe C (converted )){Converted = converted. Replace (Regexp. $1,Regexp.
events of the other mouse are introduced. MouseOver () is a mouse-moving object trigger. Mouseout () mouse moves out of the object trigger. MouseMove () is triggered when the mouse is moved in the object.
The DOM operation of jquery used:
Val () is the value that gets the element value, or it can set the value of the element value. This method of getting and setting within a function is common in jquery
The class is also HTML (), text (), Heigth (
VaR getxy = function (){
// Determine whether it is IE
If (document.doc umentelement. getboundingclientrect ){
// Note 1
Return function (EL ){
VaR box = El. getboundingclientrect ();
VaR rootnode = El. ownerdocument;Return [box. Left +Y. Dom. getdocumentscrollleft (rootnode), box. Top +Y. Dom. getdocumentscrolltop (rootnode)];};} Else {Return function (EL ){VaR Pos = [El. offsetleft, El. offsettop];VaR
Var getXY = function (){// Determine whether it is IEIf (document.doc umentElement. getBoundingClientRect ){// Note 1Return function (el ){Var box = el. getBoundingClientRect ();Var rootNode = el. ownerDocument;Return [box. left +Y. Dom. getDocumentScrollLeft (rootNode), box. top +Y. Dom. getDocumentScrollTop (rootNode)];};} Else {Return function (el ){Var pos = [el. offsetLeft, el. offsetTop];Var parentNod
Recently, I tested dom operations in jquery and events and animation methods in jquery. I wanted to elaborate on every method to introduce it, but it was boring to write it like this.
The advantage of jquery is that simple code can bring a better user experience.
So I will look for some practical examples to introduce them. The following describes the operations and events used in this section.
Html code:
Jquery code:
The Code is as follows:
when the mouse moves out of an object. Mousemove () is triggered when the mouse moves in the object.The dom operations of jquery used:Val () is to get the value of the element value, you can also set the value of the element value. This method for obtaining and setting in a function is very common in jquery.Class is also html (), text (), heigth (), width (), css (), attr () and so on.Html () and text () are distinguished here ()Html () is relative t
triggered when the mouse moves out of an object. Mousemove () is triggered when the mouse moves in the object.
The dom operations of jquery used:
Val () is to get the value of the element value, you can also set the value of the element value. This method for obtaining and setting in a function is very common in jquery.
Class is also html (), text (), heigth (), width (), css (), attr () and so on.
Html () and text () are distinguished here ()
Html (
In the field of network marketing to do a good job in SEO, must do a good job, the link is divided into external links and internal links, two of links, Seoer focus on the most or in the external links, care about these external links to the site or the Web page of the vote. We will use some software or online webmaster tools to analyze their own chain, and this one, the most well-known, most commonly used, more reliable outside the chain analysis tool is the
Fee to login Yahoo English website method:Need to pay Yahoo 299 USD (Adult content or service Web site to pay USD $600, and in the appropriate directory under business and economy/shopping and Services/sex)1. But even if you pay the dollar $299, also do not guarantee that your website must be included in Yahoo;2. Even if the site is included in
To Yahoo to submit a website, you need to pay Yahoo 299 USD (Adult content or service Web site to pay $600, and in business and Economy/shopping and Services/sex under the appropriate directory application)
* But even if you paid the dollar $299, also do not guarantee that your website must be included in Yahoo;
• Even if the site is included in
[Online, etc.] ask for Yahoo Japan api resolution (php). I will make another purchase network (Yahoo Japan, Lotte) and ask experts to help parse the two of them. Ask for Yahoo Japan api resolution (php), and I will make another purchase agency (Yahoo Japan, Lotte). ask experts to help parse the two of them. I don't kno
Web Rank, a tool that Yahoo has not launched as a Google PageRank, is being tested by a team of Yahoo's "companions" departments. Web Rank is integrated into Yahoo's latest version of the Search toolbar, which is named Yahoo Companion.
Yahoo and Google's toolbar are fundamentally different. Google's PageRank is based on the popularity of the URL and Yahoo's s
Yahoo! --Search Engine King, one of the earliest directory index, is also the most important search service site, in all Internet search applications accounted for about 36% of the share. In addition to the main station (Mother Yahoo), also has the United States metropolitan cities (Yahoo cities, such as the Chicago Sub-station), country stations (such as
Yahoo! Is the undisputed "King of search Engines," which deserves our note. For online entrepreneurs, it is worthwhile to occupy good sites on the Yahoo!.Bellies's flashed. This means that he occupies the most important marketing position on the internet,Yahoo! rankings, as an honor for advertising? To get a good rank on the
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.