Reading Notes on the art of Javascript_Dom (version 2nd)

Source: Internet
Author: User

Chapter 2 Brief History of Javascript

Dom: stable degradation, progressive enhancement, user-centric design

Chapter 1 Javascript Syntax 1. programming languages are divided into two categories: Explanatory (javascript) and compiled (java, C ++)
2. variable scope: If a function uses var, the variable is regarded as a local variable and only exists in the context of the function; otherwise, it is a global variable, if a global variable with the same name already exists in the script, this function will change the value of that global variable (which appears later.
3. built-in objects (Array, Math, Date, etc.), host objects (objects provided by the browser) (Form, Element, Image, document (any Element on a live webpage ))

Chapter 2 DOM1. three DOM methods to obtain element nodes
Document. getElementById (); document. getElementsByTagName (); document. getElementsByClassName ();
2. In Javascript, null indicates no value.
3. Element Method: getAttribute (); setAttribut ();

Chapter 1 Case Study: Javascript Image Library

Chapter 1 Best Practices 1. Stable degradation and progressive enhancement
2. Using attributes such as onclick in Html documents is inefficient and may cause problems

Chapter 2 Case Study: Upload addLoadEvent () to the script

Chapter 1 Create dynamic notation 1.doc ument. write (); not recommended
2. innerHTML (); insert a large part of HTML content. to process the inserted content, you need the precise attributes and methods provided by DOM.
3. In DOM, a document is a node tree.
4. CreateElement (); CreateTextNode (); appendChild (): connects a node to a part of the document tree, or connects two nodes that are not part of the document tree.
5. Create and insert a new node using the DOM method: createElement (), createTextNode ();
6. parentNode. insertBefore (newElement, targetElement );
7. insertAfter () is included in the script.
8. When Ajax clicks a link and sends a request to the server, wait for a whole page to be returned. Ajax can update only a small part of the page. The core of Ajax technology is XMLHttpRequest.
9. Hijax progressively enhanced Ajax
10. SEO search engine optimization

Chapter 1 enrich the content of the document 1.for( variable in array) when the first cycle, variable indicates the lower mark value of the first element in array; the second cycle indicates the lower mark value of the second element; value to the last loop. "For (... in...) loops are used to traverse arrays whose values are not integers"
2. Microsoft does not support the abbr element until IE7.
3. Javascript scripts should only be used to enrich the content of documents. Avoid using DOM technology to create core content.

Chapter 4 CSS-DOM1. <p id = "elem" style = "color: #000; font-family: Arial, Sans-Serif;"> </p>
Var para = document. getElementById ("elem"; alert (para. style. color); alert (para. style. fontFamily); minus sign contained in the hump identity conversion attribute
2. the attribute value of the style object must be enclosed in single quotes or double quotation marks. Otherwise, it will be interpreted as the variable para. style. color = "black ";
3. DOM technology (Javascript) should not be used to create important HTML content, nor DOM technology should be used to create important style information. At most, document styles can be supplemented.
4. Design of general functions

Chapter 1 animation effects with Javascript Chapter 2 HTML5 Chapter 2 comprehensive example




Contact Us

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: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.