用js动态给from增加input
发布时间:2016年12月29日 作者:未知 查看次数:1655
js向html的from动态加入input 代码:https://zhidao.baidu.com/question/2116986385183121187.html <!DOCTYPE HTML> <html> <head> <meta charset=UTF-8> <title>recursion</title> <style type= "text/css" > </style> <script type= "text/javascript" > function add () { var form = document.getElementById ( "pic_load_form" ); var node = form.children[0]; var str = node.outerHTML; form.innerHTML += str + "<br / >" ; if (form.resfile.length == 9) { b1.disabled = 'disabled' ; } } </script> </head> <body> <div align= "center" > <div> <h2>图片批量上传:仅限jpg格式</h2> </div> <button id= "b1" onclick= "add()" >增加+</button> <form id= "pic_load_form" action= "cn.chinatowercom.res.inventory.load.picupload.flow" method= "post" enctype= "multipart/form-data" > <input type= "file" id= "file" name= "resfile" class= "nui-htmlfile" width= "300px" required= "true" limitType= "*.jpg" requiredErrorText= "请选择上传的文件!" > <input type= "hidden" name= "fileStr" value= "<%=json%>" /> </form> <div align= "center" > <a class= "nui-button" iconCls= "icon-upload" onclick= "submit()" > 开始上传</a> </div> </div> </body> </html>
|
|
|