Using a variable for document.getElementById

  • Thread starter X l e c t r i c
  • Start date
X

X l e c t r i c

webtv versions prior to 2.9 do not recognize document.getElementById, so
we have to use a conditional that includes document.all.

I've been trying to use a variable for document.all and
document.getElementById to simplify my functions. It works for the
latest versions of Explorer, Opera, and webtv. It does not work for the
latest versions of Firefox, Netscape, and SeaMonkey.

Here are two examples of what I'm trying to do. It's the "DOM "with" a
variable" versions that don't work with all the browsers.

Using divisions:

http://www.xlectric.com/info/js/domvartest.html

Using forms:

http://www.xlectric.com/info/js/domvartestfm.html

I realize that with the forms versions I can use the forms array, like I
do in the third example. It works and it's valid. It's with the
divisions versions that something like this would really simplify my
functions. I even tried making a separate function that I could use as a
method within the oC() function, but I was never able to sort that out
either.

Also, the results were the same when using the HTML 4.01 strict dtd.

If it is possible to make something like this work for all the browsers,
then I would appreciate it if it could be pointed out what I'm doing
wrong.

Art
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top