Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Getting Form Parameters


rover - 7:31 pm on Apr 17, 2008 (gmt 0)


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:

<form id="myForm">
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>

<p>Get the name and value of all the elements in the form:<br />
<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 />");

document.write("<br />");
}
</script>
</p>


Thread source:: http://www.webmasterworld.com/javascript/3629387.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com