<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>
|