Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up table width question

    how do you determine the width of a table in pixels? can you do it with javascript?

    for example:
    <table>

    <tr> waaadddddupppp </tr>
    <tr> yoooooooooooo </tr>

    </table>

    The width of the table above is set according to the width of the row text How do you determine the width of the table in pixels?

    Thanks Dude.

  • #2
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <table border="0" cellpadding="0" cellspacing="0" width="745" summary="745 pixel wide table">
    	<tr>
    		<td width="345">345 pixel wide cell</td>
    		<td width="400">400 pixel wide cell</td>
    	</tr>
    	<tr>
    		<td colspan="2" width="745" height="120">745px wide, 120px high cell spanning two columns</td>
    	</tr>
    </table>
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    document.getElementById('myTable').offsetWidth;

    <table id="myTable".......>

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    Colorado
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your table code is missing something....here's an overview of what most of the table tags do:

    <table> - defines that you are starting a table
    <tr> - defines a new row in your table
    <td> - defines a new column in your table
    </td> - ends the column
    </tr> - ends the row
    </table> - ends the table

    To define the width of a table in pixels, just use
    <table width="100 "> and change the number in red to your specifications.
    -Sk8er9547


  •  

    Posting Permissions

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