[問題] 動態生成上傳欄位問題

看板Ajax作者 (看我名片檔!!)時間14年前 (2009/12/24 17:41), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
各位好 我設計一個按鈕按下去 動態產生上傳欄位 但只會固定讓它的name一樣 沒辦法每一個的name都不同 ex file1, file2...etc 因為我想要用ASP上傳 所以需要name 下面是目前寫的 請指教一下 感恩>//< <table id="product_tb" border="1" > <tr><td><INPUT name="filea" type="file"></td></tr> <tr><td><INPUT name="fileb" type="file"></td></tr> </table> <input type="button" name="addNew" value="新增上傳" onClick="AddTR()"> = ============ function CreateRow() { var tb = document.all.product_tb; // Insert one row at the reciprocal second of the table var nRow = tb.insertRow(tb.rows.length) ; var nod1="file" + (tb.rows.length-1) nCell = nRow.insertCell() ; nCell.innerHTML ="<input name='files' type='file' ><br>"; ^^^^^ 這邊有辦法每次都不同嘛>"< } function AddTR() { var tb = document.getElementById("product_tb") ; CreateRow() ; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.117.157.18
文章代碼(AID): #1BCpTcrJ (Ajax)
文章代碼(AID): #1BCpTcrJ (Ajax)