Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
  1. #1
    Senior Member
    Join Date
    Jul 2003
    Location
    Hillsboro, OR USA
    Posts
    116
    Member #
    2175
    I'm new to this forum ,and this is my first question... so let's see just how responsive this forum is. :classic:
    ----------------------------------------

    I would like to know if it is possible to make a table that will resize to a maximum resolution of 840px... BUT if the viewers screen resolution is not able to view the 840px page the table without a horizontal scroll bar would resize to 100% on their browser.
    -----------------------------------------
    Hopefully you understand my question.
    -----------------------------------------

    Thanks in advance to anybody and everybody who responds to my post.

  2.  

  3. #2
    Senior Member Grommet's Avatar
    Join Date
    Jul 2003
    Location
    Stuart, Fl
    Posts
    459
    Member #
    2129
    Liked
    3 times
    I have 0 clue how to do that or if its even possible. But since most people dont have under 800x600 id say just bring your table size down to 780 so most people can view it. Your not gonna find to many 640x480s browsin the net these days :P
    Jason Anderson
    Grommet Designs
    Web / Graphic Design

  4. #3
    Senior Member
    Join Date
    Jul 2003
    Location
    Hillsboro, OR USA
    Posts
    116
    Member #
    2175
    Thank you for your reply.

  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    You can do it through JavaScript, but I don't think it's possible through HTML. If you figure out how to do it with just HTML, then post it back here, though !!!

  6. #5
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Welcome to WDF

    Try this...
    Code:
    <html>
    <head>
    <script type="text/javascript">
    <!--
    function resize()
    {
    	size = screen.width;
    	if (size < 860)
    	{
    		document.getElementById('res').width = 100 + '%';
    	}
    	else
    	{
    		document.getElementById('res').width = 840 + 'px';
    	}
    }
    -->
    </script>
    </head>
    
    <body onload="resize()" onFocus="resize()">
    <table width="100%" style="background-color: #cccccc;" id="res">
    <tr>
    <td>Content</td>
    </tr>
    </table>
    </body>
    </html>
    JR

  7. #6
    Senior Member
    Join Date
    Jul 2003
    Location
    Hillsboro, OR USA
    Posts
    116
    Member #
    2175
    That's awesome. Thanks a lot for your help.
    -----------------------------
    However, is it possible to make it resize depending on the size of the browser window rather than the viewers screen resolution?

  8. #7
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    i think it is client.width, so change screen.width to client.width
    JR

  9. #8
    Senior Member
    Join Date
    Jul 2003
    Location
    Hillsboro, OR USA
    Posts
    116
    Member #
    2175
    I still can't get it to work....

    Thanks though.

  10. #9
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    sorry, i got my wires crossed. It should be document.body.clientWidth. Try this..
    Code:
    <html>
    <head>
    <script type="text/javascript">
    <!--
    function resize()
    {
    	size = document.body.clientWidth;
    	if (size < 840)
    	{
    		document.getElementById('res').width = 100 + '%';
    	}
    	else
    	{
    		document.getElementById('res').width = 840 + 'px';
    	}
    }
    -->
    </script>
    </head>
    
    <body onload="resize()" onFocus="resize()">
    <table width="100%" style="background-color: #cccccc;" id="res">
    <tr>
    <td>Content</td>
    </tr>
    </table>
    </body>
    </html>
    Just modified a couple of things in there, the size variable and the if statement.
    JR

  11. #10
    Senior Member
    Join Date
    Jul 2003
    Location
    Hillsboro, OR USA
    Posts
    116
    Member #
    2175
    Bro, that is so awesome. Thank you so much.

    I have been looking for a script like this for a while now (prob a month or so)... Then I put up a new thread at this forum and I get a working reply in a couple days...

    Thanks a ton.
    ------------------------------------------
    I need to take me a few more classes in SavScript.

    Do you happen to know of any good tutorial sites for JavaScript until the new school year starts?


    ::: Thanks again, bro
    : all4sma :


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:31 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com