Table width : Table Layout : Table : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP
JavaScript DHTML Home »  Table   » [  Table Layout  ]   
 



Table width

Please note that some example is only working under IE or Firefox.

    
<html>
<head>
<script language="JavaScript">
    function function1() {
        document.getElementById("myTable").width = "300";
    }
    function function2() {
        document.getElementById("myTable").width = "500";
    }
</script>
</head>
<body>
<table id="myTable" cols="3" border="3" cellspacing="5" cellpadding="5">
    <script language="JavaScript">
        document.getElementById("myTable").width = 500;
    </script>
    <tr>
        <th>Column 1</th>
        <th>Column 2</th>
        <th>Column 3</th>
    </tr>
    <tr>
        <td>Cell 1</td>
        <td>Cell 2</td>
        <td>Cell 3</td>
    </tr>
</table>
<input type="button" value="Change table width to 300px" onClick="function1();">
<input type="button" value="Restore table width to 500px" onClick="function2();">
</body>
</html>    
      
      
Related examples in the same category
1.  Table rules
2.  Table frame
3.  Table cell padding and space Example
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.