[Javascript] Add elements to form

Ben Curtis Quixote at LaMancha.org
Mon Aug 6 11:08:10 CDT 2001


>> <td id="1">Hello</td><input type="hidden name="1" value="Hello">
>> 
>> This seems a bit cumbersome. I've tried
>> 
>> document.formname.1.value='Hello';
>> 
>> Not surprisingly this doesn't work and I get  'document.formname.1 is null
>> or not an object'.
...
> 
> Exactly when do you do this? The forms array is only initalized and
> accessible after the page has been loaded completely (onLoad, in other
> words).

I've never had it fail if I call the form object after the closing form tag,
if you don't want to wait for the onload to fire. If you try to refer to the
form object before the closing tag, you get the "not an object" error.

--
+Ben Curtis

Two guys walk into a bar.
The third guy ducks and goes around it.








More information about the Javascript mailing list