"JavaScript DOM Programming Art" notes

Source: Internet
Author: User

A: This book is brought into the knowledge point by several cases, easy to understand. The greatest gains are the gradual increase and steady degradation that the authors have repeatedly mentioned.

"Progressive enhancement" refers to the same basic usage experience as the user, and gives more advanced users a more efficient and easy user experience based on the level of the user terminal. "Smooth degradation" is equally a benchmark for all users, but in the opposite direction of progressive enhancement, this approach is to deprive low-level users of some experience.

Two: Solve some browser incompatibility HTML5, CSS3 problem

Use Modernizr to resolve

Https://modernizr.com/download?setclasses

Three: Methods

Loading functions, complex code is more convenient with this method

// methods of loading functions, such as addloadevent (functionname), are equivalent to Window.onload function Addloadevent (func) {  var oldonload = window.onload;   if (typeof window.onload! = ' function ')    {= func  ; Else {    function() {      oldonload ();      Func ();   }}}
functionloadevents () {//Homeprepareslideshow (); // AboutPrepareinternalnav (); //PhotosPrepareplaceholder ();  Preparegallery (); //LiveStripetables ();  Highlightrows ();  Displayabbreviations (); // Contactfocuslabels (); Prepareforms ();}//Load Eventsaddloadevent (highlightpage); addloadevent (loadevents);

InsertAfter () method does not exist in H5

// Insert before an element node function InsertAfter (newelement,targetelement) {  var parent = Targetelement.parentnode;   if (Parent.lastchild = = targetelement) {    parent.appendchild (newelement)  ; Else {    parent.insertbefore (newelement,targetelement.nextsibling);  }}

Append class

// method of appending class function addclass (element,value) {  if (!  Element.classname) {    = value;   Else {    = element.classname;    Newclassname+ = "";    Newclassname+ = value    ; = newclassname;  }}

"JavaScript DOM Programming Art" notes

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: info-contact@alibabacloud.com 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.