[問題] 動態生成上傳欄位問題
各位好
我設計一個按鈕按下去 動態產生上傳欄位 但只會固定讓它的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
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):