JavaScript_Util_02

   HTMLElement.prototype.next = function(){
       var elem = this;
       do{
           elem = elem.nextSibling
       }while(elem&&elem.nodeType!=1);
       return elem;
   };
   document.body.firstChild.next();
   
   function id(name){
       return document.getElementById(name);
   }
   function tag(name,elem){
       return (elem||document).getElementsByTagName(name);
   }
   
   next(tag("h1")[0]);

HTML DOM 解析顺序

1.HTML解析完毕

2.外部脚本和样式加载完毕。

3.脚本在文档内解析并执行

4.HTML DOM完全构造起来

5.图片和外部内容加载

6.网页完成加载

原文地址:https://www.cnblogs.com/Lennyyi/p/4761835.html