As follows:
<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <title></title></Head><Body><DivID= "Cnt-main-article-qq"Bosszone= "Content"> <Pclass= "Titdd-article">According to statistics, the national dwarf disabled more than 6 million people, long-lived in Beijing, more than 5000 pocket people.</P> <Pstyle= "Text-indent:2em">Beijing News</P> <Pstyle= "Text-indent:2em">Beijing News</P> <Pstyle= "Text-indent:2em">Beijing News</P> <Pstyle= "Text-indent:2em">Beijing News</P> <Pstyle= "Text-indent:2em">Beijing News</P> <Pstyle= "Text-indent:2em">(last line)</P></Div><Scripttype= "Text/javascript"> varDiv=document.getElementById ("CNT-MAIN-ARTICLE-QQ"); varnodes=Div.getelementsbytagname ("*"); varFirstChild=nodes[0]; varLastChild=Nodes[nodes.length- 1]; document.write ("last Node ID:"+Lastchild.text_node+"<br>"); document.write ("last node Name:"+Lastchild.nodename+"<br>"); document.write ("The last element inside the code:"+lastchild.innerhtml+"<br>"); varOP=Lastchild.appendchild (Document.createelement ("a")); Op.setattribute ("href", "http://www.qq.com"); Op.setattribute ("ID", "Link"); varLink=document.getElementById ("Link"); Link.innerhtml= "links";</Script></Body></HTML>
Advanced approach, please: DOM usage:
Http://www.cnblogs.com/ahthw/p/4140368.html
11. Insert a new element after a specific node (January 9, 2015 supplement)
A small example of appending elements within a page