<div class="codetitle"> <span><a style="CURSOR: pointer" data="49815" class="copybut" id="copybut49815" onclick="doCopy('code49815')"><u>复制代</u></a></span>代码如下:</div> <div class="codebody" id="code49815"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml" > <BR><頭> <BR><title>add_line</title> <br><script language="javascript" type="text/jscript"><!-- <br><br>function add_input_file(tbfile,index) <BR>{ <BR>file_name = "file"索引; <BR>var tr_file = document.createElement("tr"); <BR>var td_file = document.createElement("td"); <BR>var input_file = document.createElement("input") <BR>input_file.setAttribute("type","file") <BR>input_file.setAttribute("size","50") <BR>input_file.setAttribute ("name",file_name) <br><br>td_file.appendChild(input_file) <BR>tr_file.appendChild(td_file) <BR>tbfile.appendChild(tr_file) <BR>} <BR>function add_one_file() <BR>{ <BR>var tb_file = document.getElementById("upload_file"); <BR>var count_file = document.getElementById("upload_file").childNodes.length; <BR>//window.alert(steps_nums); <BR>add_input_file(tb_file, count_file); <BR>} <br><br>// --></script> <br></head> <br> <br><div style="text-align: center" style="text-align: center"> <br> <br><テーブル幅="90%"> <br><tr> <br><td> <br><br> <br><br> <br><h5>配置文件上传</h5> <br></td> <br></tr> <br> </td> </tr> <tr> <br><td> <br><table id="upload_file"> <br><tr class="tabletext"> <br><td><input type="file" name="job" size="50"/></td> <br></tr> <br><tr class="tabletext"> <br><td><input type="file" name='file2' size="50"/></td> <br></tr> <br><tr class="tabletext"> <br><td><input type="file" name='file3'size="50"/></td> <br></tr> <br></table> <br></td> <br></tr> <br><br><tr> <br><td align="left"> <br><input type="button" value="新增一行" onclick="add_one_file()"/> <br><input type="submit" value="保存"> <br><input name="ciname" value="{{ciname}}"/> <BR><input name="type" value="default"/> <br></td> <br></tr> <br></table> <br></form> <br> <br></body> <br></html> <br><br>すべての代コード コレクションは 1 つの html 文書として保存されています。 .createElement 创建一种页面标签 <br>setAttribute: 何らかの一标签設置プロパティ <br>appendChild: 在另一标签中に一子标签を追加</td> </tr> </div>