Page is a not externally linkable
rover - 7:31 pm on Apr 17, 2008 (gmt 0)
<form id="myForm"> <p>Get the name and value of all the elements in the form:<br /> document.write("<br />");
O.k. I found some ideas, and I did find a way that I could access the corresponding values through something like this using an id value the same as the field name value. In case it is helpful to anyone else:
Firstname: <input name="fname" id="fname" type="text" value="Mickey" />
Lastname: <input name="lname" id="lname" type="text" value="Mouse" />
<input id="sub" type="button" value="Submit" />
</form>
<script type="text/javascript">
var x=document.getElementById("myForm");
for (var i=0;i<x.length;i++)
{
document.write(x.elements[i].id);
document.write(" --> ");
document.write(x.elements[i].value);
document.write("<br />");
}
</script>
</p>