PDA

View Full Version : JavaScript and CSS Trouble



Voetsjoeba
February 1st, 2004, 11:22 AM
Hello :)

I'm having trouble using Javascript and CSS. I'm trying to make a table the height of the available monitor size. So from the bottom of the bars at the top of the screen to the top of the bars at the bottom of the screen. In IE, this should be document.body.clientHeight, but this keeps returning 0. I'm testing this in IE 6.0. And in Mozilla, NS, and Firebird this should be screen.innerHeight.

After that, I was thinking about making the table quite large, and then to disable scrollbars. <body scroll="no"> works, but only in IE. Lostinbeta posted this CSS code that should work in all browsers:


body {
overflow: hidden;
}

Doesn't work either ! The scrollbar is still there ! So I tried to do it with Javascript: document.body.style.overflow = "hidden", and guess what: not working.

What am I doing wrong here ??

Voetsjoeba
February 1st, 2004, 11:26 AM
I found out that when I remove the DOCTYPE, the CSS is working. It's set to <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">. Of course, removing it isn't quite the ideal situation ...

senocular
February 1st, 2004, 12:15 PM
Doh I could have told you that. 4 minutes wasnt enough time to react though ;)

Voetsjoeba
February 1st, 2004, 12:20 PM
Heh :P

Is removing the DOCTYPE really the best solution here ? From testers I heard that the CSS thingy worked for FireBird, but not in IE, and I know that body scroll="no" only works in IE ... so I guess if I combine them, it should work.

senocular
February 1st, 2004, 12:31 PM
to be honest I dont know. That kind of stuff, though, is why I just avoid doctype. Is that a good thing? Probably not. I just want my pages to work ;)

λ
February 1st, 2004, 01:30 PM
I find most of the problems are with combining the old(tables) with the new(doctypes & css)...

I always use XHTML 1.0 Strict or XHTML 1.1, and I've never had problems. But I use tables semantically, not for layout, which I use CSS for.

You've just come across one of the hundreds of CSS bugs in IE voets ;)

Voetsjoeba
February 1st, 2004, 01:33 PM
Oh, wonderful. :P

It seems to be working with the body scroll="no" for IE and the CSS for NS based browsers ... Thanks for the replies, guys :)