Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
October 23, 2014, 06:34:19 AM

Pages: [1]   Go Down
  Print  
Author Topic: Accessing the overflow property using Javascript  (Read 2393 times)
tomrichey
Spacescooter Operator
*****
Offline Offline

Posts: 42


WWW
« on: January 30, 2008, 03:48:15 PM »

Hello everyone:

I am working on a page that contains a table which runs off of the screen (vertically) in low screen resolutions, but not in high resolutions.  Up until now I have been making the scroll bar appear in low resolutions but not in high ones using the following CSS:

 html,body
  { margin:0;
     padding:0;
     height:100%;

     <?php if ($ScreenHeight > 768)
       { ?> overflow:hidden; <?php } ?>

     border:none;
   }

But this is not enough any longer.  Different users have different amounts of available vertical space, and this code may turn off the scroll bar when it shouldn't or not turn it off when it should.  I am able to calculate the pixel height of all of the tables on the page using offsetHeight, and I need to set the overflow property based on the numbers I get from offsetHeight.  The problem is that when I try to access the overflow property using document.body.style.overflow, which is a command format that I have seen in several tutorials, when I try to print out its value I always get nothing, and when I try to set its value to "hidden" it has no effect on the page.

What command do I need to set the overflow property using Javascript?

Thanks for your help,
Tom Richey
Logged
tomrichey
Spacescooter Operator
*****
Offline Offline

Posts: 42


WWW
« Reply #1 on: January 31, 2008, 08:31:47 AM »

Never mind, I solved the problem using the document.styleSheets command.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: