javascript|js| Dynamic General, we use
Request.getparameter ("value");
To get the value of the static HTML input. Then don't forget to judge whether it is empty, whether it contains special characters, etc.
can also use
Enumeration Paramnames=request.getparameternames ();
while (Paramnames.hasmoreelements ()) {string paramname= (String) paramnames.nextelement ();}
To collect name from the <input type= "text" name= "name"/>
But each new line we add, the parameter name is the same as the previous line, so how do we get the value?
Here I went to read (Servlet and JSP core programming, a very good book, it is said, read and understand it servlet/jsp can also say proficient) p70 page: Getparametervalues () returns an array of strings, Then we use the loop to determine the length of the string array, and then we get the value:
Request.getparameter ("value");//This is the most familiar, get the value of the text box
(enumeration) request.getparameternames ();//Get the name of the text box
(string[]) request.getparametervalues (paramname);//Get the value of the same argument (multiple occurrences) of the static HTML page
HTML page JavaScript code:
<script language= "JavaScript" >
function Tbladdrow ()
{
var i=lines.rows.length;
var row = Table1.insertrow (Table1.rows.length);
var col = Row.insertcell (0);
col.innerhtml = "<input id=line[" +i+ "][name1" Name=line "+i+ name1";
Col = Row.insertcell (1);
col.innerhtml = "<input id=line[" +i+ "][name2" Name=line "+i+ name2";
Col = Row.insertcell (2);
col.innerhtml = "<input id=line[" +i+ "][name3" Name=line "+i+ name3";
Col = Row.insertcell (3);
col.innerhtml = "<input id=line[" +i+ "][name4" Name=line "+i+ name4";
}
function Tbladdrows (items)
{
for (i = 1; I <= items; i++)
{
Tbladdrow ();
}
}
function Delrow ()
{
if (lines.rows.length==0)
{
return false;
}
Lines.deleterow ();
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.