[英]Dynamically Created Form Elements not submitting with form
I have added some input type elemets in form using javascript.On submitting the form, these elements are not showing 我使用javascript在表单中添加了一些输入类型的元素。提交表单时,这些元素未显示
var pos=document.getElementById(rid).rowIndex;
var new_row=document.getElementById("table1").insertRow(1+pos);
new_row.id="newRow"+rowCount;
var td5=new_row.insertCell(4);
td5.align="left";
td5.innerHTML="<textarea id=\"emailID\" name=\"emailID\" cols=\"40\" rows=\"5\" class=\"textbox\"></textarea>";
I also checked with 我也检查过
var emailText=document.createElement("textarea");
emailText.id='emailID';
emailText.name='emailID',
emailText.cols=40;
emailText.rows=5;
emailText.className="textbox";
td5.appendChild(emailText);
On submit i checked 提交后我检查了
alert(document.formName.emailID);
But this is showing undefined. 但这显示未定义。 Can any tell where i am wrong?
有谁能告诉我我错了?
像这样尝试:
document.forms[0].elements["emailID"];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.