Using JS to make 163 landing Page Ultimate Version (write a night), some features are not perfect, interested can go to their own to achieve some functions, basically all the functions I have realized, only a few did not realize, there are some regular expression of the use, mainly or table design, not with Div, Next time you upload a div.
Look at the HTML code below:
<! DOCTYPE html>
Here is the JS code:/** * * @param idorname If the incoming ID is preceded by # if the incoming name is passed directly into the * @returns {*} returns the element node if not found returns null */function $ (idorname) {VA R Obj=null; if (idorname) {if (Idorname.charat (0) = = "#") {Obj=document.getelementbyid (idorname.substring (1)); }else{Obj=document.getelementsbyname (idorname); }} return obj; /** * * @param parentnode parent node * @returns {Array} all element child nodes */function Getchildnodes (parentnode) {var childs=parentnode . childNodes; var newchilds=[]; for (Var i=0;i<childs.length;i++) {if (childs[i].nodetype==1) {Newchilds.push (childs[i]); }} return newchilds;} /** * * @param parentnode parent node * @returns {*| node} The first element nodes */function Getfirstchild (parentnode) {var firstchild=parentnode.firstchild; if (firstchild.nodetype==3) {firstchild=firstchild.nextsibling; } return firstchild;} /** * * @param parentnode parent node * @returns {*| Node} last element */function Getlastchild (parentnode) {var LastchiLd=parentnode.lastchild; if (lastchild.nodetype==3) {lastchild=lastchild.previoussibling; } return lastchild;} /** * * @param node ELEMENT nodes * @returns {*| Node} returns the next sibling element */function getnextsibling (node) {var nextnode=node.nextsibling; if (nextnode.nodetype==3) {nextnode=nextnode.nextsibling; } return nextnode;} /** * * @param node ELEMENT nodes * @returns {*| Node} returns the previous sibling element nodes */function getprevioussibling (node) {var prenode=node.previoussibling; if (prenode.nodetype==3) {prenode=prenode.previoussibling; } return Prenode;}
The interface achieves the following effects:
Using JS to make 163 landing page Ultimate Version (written for one night)