Ok, in that case you don't really need a <form> element, but it's ok to leave the <form>
This quick and simple demo code shows how you can store input data into 2 arrays called inp1 and inp2 and display their values when you click the "Validate" button.
Once you have the 2 arrays, you can do what you like with the values in them.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
<!--
function validate() {
var inp1 = document.getElementsByName('i');
var inp2 = document.getElementsByName('h');
//display the input data
var str = '';
for(var i=0; i < inp1.length; i=i+1) {
str += 'Input 1.'+(i+1)+' = '+inp1[i].value+"\nInput 2."+(i+1)+' = '+inp2[i].value+"\n";
}
alert(str);
}
//-->
</script>
</head>
<body>
<div>
Input 1.1 <input type="text" name="i"/><br />
Input 1.2 <input type="text" name="i"/><br />
Input 2.1 <input type="text" name="h"/><br />
Input 2.2 <input type="text" name="h"/><br />
<input type="button" value="validate" onclick="validate();" />
<div>
</body>
</html>
Bookmarks