views:

49

answers:

2

I have a 'n' column table , the first column is a drop down box , on selecting the options from the drop down, the other columns change. For eg: first drop down might need to display a text box and a button , the second drop down 3 text boxes and a button and so on. There is only one row in the table. What is the best solution to achieve this.

with Sincere thanks,

A: 

you can give the table fixed width and if you add a new column you can give this one also a fixed width or height.

Somehting like this:

<html>
<body>

<table border="1">
  <tr>
    <td width="75">Column 1</td>
    <td width="125">Column 2</td>
  </tr>
</table>

</body>
</html>

And the Javascript

<script type="text/javascript" language="javascript">   
    var tdTag = document.createElement("td");

    tdTag.id = "td1";

    tdTag.height="300";

    tdTag.width="200";

    tdTag.innerHTML = "<button>1</button><button>2</button><button>3</button>";

    document.table.tr.appendChild(tdTag);
</script>
michel
@michel: You are mixing up CSS and HTML syntax. In HTML lengths in pixels are written without an unit so it should be `width="75"`.
RoToRa
@RoToRa : thanks for your comment i changed it
michel
A: 

why not jquery plugins? jquery column manager will help a lot i think.

Danny Chen