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

tedd tedd at sperling.com
Sat Apr 12 08:56:36 CDT 2008


At 5:44 PM -0400 4/11/08, Claude Schneegans wrote:
>The only reason I see this could not work would be:
>1. there is no element Id
>2. there is more than one, in this case nobody knows what can happen.
>3. the element Id is not a checkbox or a radio button.

Claude:

1. The element ID does exist.
2. There is only one element by that name.
3. That element is a checkbox.

So, there must be another reason.

However, in IE the code generates an:

    Error: 'document.getElementById(...) is null or not an object.

The offending code is this:

function HideTimedLayer(id)
    {
    document.getElementById(id).style.display = "none";
    var id2 = 'c' + id[2] + id[3];
    document.getElementById(id2).checked = true;
    }

I do have checkboxs with the id's of q11 and c11. In the above 
function, I simply want checkbox q11 to be not shown and checkbox c11 
to be checked. But, in IE the code generates the above error and in 
everything else, it works.

So, what do you see the problem to be?

Cheers,

tedd


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



More information about the Javascript mailing list