|
-
Oct 23rd, 2002, 06:15 AM
#1
Thread Starter
Addicted Member
Javascript and HTML hidden fields
OK, I have some hidden fields in my HTML document:
<input type="hidden" name="myField" value="1"/>
<input type="hidden" name="myField" value="2"/>
<input type="hidden" name="myField" value="3"/>
As you can see, they all have the same name, but different values. I am using servlets and JSP which allow you to use the request.getParameterValues("myField") methods, which return an array of strings.
However, I want to access these from a javascript function. So how do I do this? I've tried:
for(int i = 0; i < TheForm.myField.length; i++) document.write(TheForm.myField[i].value);
but this doesn't work.
Any ideas would be greatly appreciated.
HD
-
Oct 23rd, 2002, 06:40 AM
#2
Drop the int in the for loop
-
Oct 23rd, 2002, 06:42 AM
#3
Also I assume that bit of code is in a function
-
Oct 23rd, 2002, 06:48 AM
#4
Thread Starter
Addicted Member
Cheers for that, should have thought of it myself but I was too stupid to look!
Thanks again.
HD
-
Oct 23rd, 2002, 04:01 PM
#5
Make sure this works with Mozilla, I'm not sure if it does.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|