[thelist] Forms and getElementById
Peter-Paul Koch
gassinaumasis at hotmail.com
Wed Jan 29 10:21:01 CST 2003
>I am having a difficult time with something that should be simple. I have
>a form and I have two javascript functions that I want to use to validate
>this form. One to check the validity of an e-mail address, and one to make
>sure all of the fields have a value. The problem is, if there is an error
>on the form, I have an image of a red arrow hidden next to each textbox
>which I would like to make visible. I have set id's for all of the images
>to be the same as the names of the form elements they correspond to.
>However, when I try to use getElementById, I can't get the image tag,
Which browser? IE Windows returns the element with name="test" if you ask
for getElementById('test'). If this problem only comes up in IE Win, change
the names of the images.
I think you should change them anyway, for instance by adding '_img' to the
form field name.
--------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.xs4all.nl/~ppk/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
W3C DOM Compatibility Table, expanded & updated
http://www.xs4all.nl/~ppk/js/index.html?version5.html
--------------------------------------------------
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
More information about the thelist
mailing list