这个问题出现在solving my last question之后,我想从隐藏窗体中获取一些值,但是当我尝试仅检索到空字符串时,我只考虑使用数组来存储引入的信息,但是我想知道是否有可能仅仅在之后检索它,以及如何检索它。如何获取隐藏或自动生成的内容的值?
此外,还有是与一些JavaScript动态生成的表:
function createTable(){
if (document.getElementById("invoiceFormat").rowNumber.value != ""){
rows = document.getElementById("invoiceFormat").rowNumber.value;
}
var contents = "<table id='mt'><tr>";
if (document.getElementById("invoiceFormat").cb1[0].checked){
contents = contents + "<td class='htd'>Quantity</td>";
}if (document.getElementById("invoiceFormat").cb1[1].checked){
contents = contents + "<td class='htd'>Description</td>";
}if (document.getElementById("invoiceFormat").cb1[2].checked){
contents = contents + "<td class='htd'>Unitary Price</td>";
}if (document.getElementById("invoiceFormat").cb1[3].checked){
contents = contents + "<td class='htd'>Subtotal</td>";
}
for (i=4; i<=k; i++){
if (document.getElementById("invoiceFormat").cb1[i].checked){
contents = contents + "<td>" + document.getElementById("invoiceFormat").cb1[i].value + "</td>";
}
}
contents = contents + "</tr>";
for (j=1; j<=rows; j++){
contents = contents + "<tr>";
for (l=0; l<=k; l++){
if (document.getElementById("invoiceFormat").cb1[l].checked){
hotfix = l +1;
contents = contents + "<td> <input id='cell" + j + "_" + hotfix + "' name='cell' type='text' size='15' /> </td>";
}
}
contents = contents + "</tr>";
}
contents = contents + "</table>";
var createdTable = document.getElementById("mainTable");
createdTable.innerHTML = contents;
}
它的创建后,我试图访问它,但没有运气到目前为止,我不能得到什么用户在创建的输入字段中输入。我怎样才能做到这一点?
我使用的是JavaScript的原料使用jQuery所以带或不带库的答案,欢迎:)