Dynamically-generated hidden input fields

Philip Thompson <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <[email protected]>
Hi there. I am dynamically creating hidden input fields in JS. As  
usual, IE is giving me problems. I can do this in FF and it works  
fine, but as soon as I attempt to access this in IE, it explodes:

<js>
var form = document.alertForm;
var count = form.length;

for (var i=0; i<count; i++) {
     // This works fine in IE - all fields print
     alert(form.elements[i].name+': '+form.elements[i].value);
}

// This does NOT work in IE, but does in FF
// 'call_method' is a hidden input that I create dynamically
alert(form.call_method.name+':: '+form.call_method.value);
</js>

Note, in the for() loop, 'call_method' displays its name and value  
just fine. But when I attempt to access it directly  
(form.call_method), it doesn't work in IE - I get an "Error on page"  
with the error being "Object expected", code 0. Anyone know of a work- 
around/solution for this?

Thanks,
~Philip
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.