Results 1 to 2 of 2

Thread: Why the scrollbar?

  1. #1
    Join Date
    Jun 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Why the scrollbar?

    I used this simple little code to center a table in the middle of a screen based on resolution. When I run it, though, I'm getting a table bigger than the screen with vertical and horizontal scroll bars. Can anyone see why?

    Thanks,
    Arch

    Code:
    <html>
    <head>
    <title>Untitled document</title>
    </head>
    <body TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0>
    <script type="text/javascript">
    document.write('<table width='+screen.width+' height='+screen.height+' bgcolor=blue 
    
    cellpadding=0 cellspacing=0><td width='+screen.width+' height='+screen.height+' align=center 
    
    valign=center>')</script>
    <table width=600 height=300 bgcolor=red cellpadding=0 cellspacing=0><td width=600 
    
    height=300>&nbsp;</td></table>
    </td></table>
    </body>
    </html>
    Last edited by ArchibaldBarashol; 06-16-2009 at 07:45 PM. Reason: Adding info detail...

  2. #2
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    I bet it's because your screen is bigger than your viewport. http://www.google.com/search?hl=en&q=browser+viewport
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •