1. You can dynamically add or delete objects that upload files
2. Automatically process file path to get file name.
3. Automatically calculate the number of files to be uploaded
<pead> <meta http-equiv= "content-language" content= "ZH-CN" > <script> function mcreatefile (obj) { var eF var mname mfilename.innerhtml= "" if (obj.id== "File") {for (i=0;i<mfile.children.length-1;i++) {if (mfile.children[i].value== "") {Mfile.removechild (mfile.children[i])} else {mname=mfile.children[i].value.split ("\") mfilename.innerhtml+= "<div id=namedetail title= '" + mname[mname.length-1]+ "' >" +mname[mname.length-1]+ "</div>"} mstatus.innerhtml= "Total <b>" + (mfile.children.length-1) + "</b> files waiting to upload"} if (obj.id== "File_new") {ef=document.createelement (' <inpu T type= "file" name= "file" size= "Id=file_new onpropertychange=" Mcreatefile (This) ">") mfile.appendchild (EF) obj . id= "File"}} </script> <style> table{FILTER:progid:DXImageTransform.Microsoft.Shadow (directio N=135,color= #999999, StreNGTH=3); input{border:1px Soild #000000; Font-family:verdana,arial, song body; font-size:12px; padding:2px; } #mTD {line-height:24px; } #mFile {width:203px; Float:left; | #mFileName {float:right; width:182px; } #NameDetail {Overflow:hidden; width:176px; Color: #000000; Font-family:verdana,arial, song body; font-size:12px; Cursor:default; height:22px; } #mstatus {font-size:12px; Color: #ff0000; } </style> </pead> <body> <form name=frm method=post> <div align= "center" > <table B Order= "1" width= "420" bordercolor= "#0066cc" cellpadding= "4" bgcolor= "#D0F0FF" > <tr> <td bgcolor = "#3399FF" height= "align=" "Center" ><font color= "#FFFFFF" size= "3" ><b> Add attachment </b></font> </td> </tr> <tr> <td id=mtd> <div id=mfile><input type= "file" n Ame= "File" size= "Id=file_new onpropertychange=" Mcreatefile (this) ></div> <div ID=mfilename></div> <div id=mstatus> A total of <b>0</b> files waiting for upload </div> </td> </tr> </table> </div> </form> </body>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]