1. Add and remove HTML nodes
2. Upload Picture preview
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "lang=" gb2312 "> <pead> <title > Add, delete HTML node & upload picture preview </title> <meta http-equiv= "Content-type" content= text/html; charset=gb2312 "/> <meta name=" author "content=" Maple Rock, http://www.cnlei.com "> <meta name=" keywords "content=" "/> <meta name=" description "content=" "/> <script type=" Text/javascript "> <!--function AddChild (s Pid) {var otextnode = document.getElementById ("Tplnode"). getElementsByTagName ("li") [0]; var oclone = Otextnode.clonenode (Otextnode); var P=document.getelementbyid (SPid); P.appendchild (Oclone); function Delchild (o,spid) {var otextnode = O.parentnode; var P=document.getelementbyid (SPid); P.removechild (Otextnode); The function previewimg (o,spid) {document.getElementById (sPid). Src=o.value; }--> </script> </pead> <body> <ul id= "Tplnode" > <li><input type= "File" name= "" value= "" size= "" onchange= "Previ Ewimg (This, ' previmg '); "/> Delete </li> </ul> <ul id=" Upfiles "> <li><input type=" File " Name= "" value= "" size= "" onchange= "previewimg (This, ' previmg ');"/> Delete </li> </ul> <p> Add Accessories </p> <p> picture preview:<br></p> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]