View Full Version : DOM issues with CSS

11-01-2002, 05:45 PM
Hey, everyone.

I have a javascript function that switched the display property for a series of DIVs on my page. This works in IE 6 and NS 7:

function toggle_folder(id){
var folderx = "folder" + id;
if (document.getElementById(id).style.display == "block"){
document.getElementById(id).style.display = "none";
document.getElementById(id).style.display = "block";

My question is in regards to the IE 5.X DOM; does it support the getElementById method, or do I need to use the document.all? I am waiting for my sys admin to come by and modify my permissions so I can install IE 5 and test it, but I thought I'd ask here as well. So if anyone knows the answer to this, I'd appreciate the help!


[to the mods: not sure if this belongs in the CSS or DOM forum. If it is posted incorrectly, I apologize and ask for you to please move it to the proper forum. Thanks!]

Roy Sinclair
11-01-2002, 06:16 PM
document.getElementById is supported by IE 5.0 and later.

11-01-2002, 06:23 PM
Thanks, Roy. I had a feeling, but I wasn't sure.

Another question just came up (not really related to CSS or DOM issues); when I get the appVersion for IE, it returns 4.0 (compatable; MSIE 6.0; blah blah blah...) Now, under Help -> About Internet Explorer, it says I am running version 6. Which is it? I'm getting confused...

Anyway, thanks again!

Roy Sinclair
11-01-2002, 07:32 PM
The responses you get from appVersion should be considered a pack of lies in just about every browser. What's displayed there was and often still is used to determine whether a browser can handle various "features" and as new versions of browser came out with new capabilities they often "fudged" the appVersion to keep it compatible with those scripts rather than listen to complaints about how their fancy new browser broke a bunch of web sites (reality is that the web sites are broken but it's usually the browser vendor that gets the blame).

11-01-2002, 09:34 PM
Now, is that true for logs from our server as well? Over 50% of our visitors are running IE 5.X... or are they...? :confused:

Maybe it's just easier to ask which browser/version combinations my code above will fail under; obviously, I'm pretty confused about the DOM issue...

Thanks again Roy.