[Javascript] IE work-a-round question (re: checkboxes)

tedd tedd at sperling.com
Fri Apr 11 15:56:38 CDT 2008


Hi gang:

I wrote the following application and it works fine on most browsers 
except for IE's.

http://webbytedd.com/quarters

It seems that IE js doesn't understand the following statement:

document.getElementById(id).checked = true;

Granted all that line does is to set a checkbox variable (id) to 
'on'. Surely, some $M code can do that, right?

After reading a bunch, it seems that M$ has a better way to do things 
(big surprise there, huh?) and thus does not use the 
document.getElementById(id) thing that everyone else in the world 
uses. Instead, they use something "better" and it's not documented 
well, as is typical.

Unfortunately, I have not been able to find a work-a-round.

So, what I need is:

if (document.getElementById)
    {
    document.getElementById(id).checked = true;
    }
else
    {
    <<<<< inset solution here. >>>>>>
    }

All the code has to do is to set a simple checkbox to 'on' in IE.

Anyone have any ideas?

Cheers,

tedd

PS: I've posted this question on the php list as well.

PSS: You have to wonder how much more technically advanced we would 
be if we weren't always held back by the "what's in it for me" 
shortsightedness of M$.

-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com



More information about the Javascript mailing list