IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Mozilla hidden fields
I'm trying to figure out why Mozilla (1.2 & 1.3) doesn't like the getElementByID() function for hidden fields. The following works in IE but not Mozilla (ie shows displays "bar" in the alert, whereas Mozilla complains that document.getElementById("foo") has no properties).

<html>
<head>
<title>test me</title>
</head>
<body>
<form name='fred'>
Hello
<input type='hidden' name='foo' value='bar' />
</form>
</body>
<script>
alert(document.getElementById("foo").value);
</script>
</head>
Expand Edited by ChrisR April 8, 2003, 06:59:46 PM EDT
New input needs to be inside a form, I think
-YendorMike

[link|http://www.hope-ride.org/|http://www.hope-ride.org/]
New Forgot the form tags....
...edit the above to include the form tags, but it still seems to have the same problem.

scratch that idea.... doesn't work for 'text' fields either.

Must be missing the obvious. :-(
Expand Edited by ChrisR April 8, 2003, 07:03:48 PM EDT
New Hmmm
Could be a couple of simple things. Those're always the things to check first, IMHO. Just a couple of WAG's, so don't shoot me if they're wrong...

1) Move the script elements to the head of the document.

2) <script name="Javascript1.2"> instead of just <script>.
-YendorMike

[link|http://www.hope-ride.org/|http://www.hope-ride.org/]
New getElementById needs an id, not a name?
try <input type='hidden' id='foo' name='foo' value='bar' />

Many fears are born of stupidity and ignorance -
Which you should be feeding with rumour and generalisation.
BOfH, 2002 "Episode" 10
New Mucho Gracias
That's what I was missing - setting the ID makes the function work. Seems like I've been bitten by this one before - but in the opposite direction.

Thanks. You've saved countless hours of head scratching. :-)
     Mozilla hidden fields - (ChrisR) - (5)
         input needs to be inside a form, I think -NT - (Yendor) - (2)
             Forgot the form tags.... - (ChrisR) - (1)
                 Hmmm - (Yendor)
         getElementById needs an id, not a name? - (tseliot) - (1)
             Mucho Gracias - (ChrisR)

Get the ball in the pocket!
140 ms