[thelist] [javascript] getElementById

.jeff jeff at members.evolt.org
Wed Oct 23 19:50:01 CDT 2002


paul,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Paul Bennett
>
> FYI, that value I was trying to access was in a select
> list - would that change the elements properties? I
> thought that it would still have a value property in a
> similar manner to a textbox, [...]
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

ok, this is the third time this thread and misconception has been discussed on thelist in the past week or so.  i'll just link to my responses so i don't have to repeat myself:

RE: [thelist] Netscape Bugginess
http://lists.evolt.org/archive/Week-of-Mon-20021014/124654.html

RE: [thelist] Netscape Bugginess
http://lists.evolt.org/archive/Week-of-Mon-20021014/124662.html

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> as this is set in the "option" tag I felt it would be
> simpler to pass the id of the select list to the
> getElementById method and get the value from there,[...]
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

ok, i'm not meaning to yell at you.  this is really meant to get the attention of anyone else using non-dom 0 means of accessing forms and form elements.

DO NOT USE NON-DOM 0 TECHNIQUES, SPECIFICALLY GETELEMENTBYID(), GETELEMENTBYTAGNAME, ETC. FOR ACCESSING FORMS AND FORM ELEMENTS.  YOU'RE NEEDLESSLY CRIPPLING YOUR FORM FUNCTIONALITY FOR A PORTION OF YOUR AUDIENCE.  STICK WITH DOM 0 FOR FORMS, IT'S NOT GOING AWAY AND WILL WORK WITH *ANY* BROWSER THAT IS JAVASCRIPT ENABLED.

i swear this alone is going to be the focus of my next "forms & javascript living in harmony" article.  it'll be subtitled something like "castration for the sake of standards"

;p

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> I can now see, however, that simply declaring a
> "shortcut" var in the function and appending the
> parameter passed to it would accomplish the same
> purpose. (phew!)
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

definitely.




More information about the thelist mailing list