我在這裏我的Javascript代碼添加了動態文本框(行)我的問題是如何將動態文本框的值保存到使用PHP腳本的數據庫中?希望你能幫助我的傢伙..謝謝!如何使用PHP添加動態文本框(行)並保存到數據庫
function addRow(r){
var root = r.parentNode;//the root
var allRows = root.getElementsByTagName('tr');//the rows' collection
var cRow = allRows[0].cloneNode(true)//the clone of the 1st row
var cInp = cRow.getElementsByTagName('input');//the inputs' collection of the 1st row
for(var i=0;i
cInp[i].setAttribute('name',cInp[i].getAttribute('name')+'_'+(allRows.length+1))
}
root.appendChild(cRow);
}
function shownames(){
var allInp=document.getElementsByTagName('input');
for(var i=0;i
alert(allInp[i].name)
}
}
我的HTML代碼: