Expanding a column

I'm having problems when I try to change the size of a column in one of my tables.  Basically, I want to hide a column (by initially setting the size to 0) and then expand it to show a table within this column.  The problem that I'm experiencing is that when the column expands to the correct size, the size of the preceeding columns in the table are then reduced and the format of the table is all messed up.  I'm using JavaScript to set the size of the DIV to 450.  Below is the JS & html that I'm using for my page.

<script language="JavaScript">
function ResizeColumn() {
      var objRS = document.getElementById("EmpInfo").style;
      objRS.display="block";
}
</scipt>

<table border="0" cellspacing="0" cellpadding="0">
      <tr>
            <td width="150"><p style="margin-left: 15">Employee Name</td>
            <td width="150">Title</td>
            <td width="0">
                  <div id="EmpInfo" style="display: none">
                        <table border="0" width="450" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="33%">InfoA</td>
                            <td width="33%">InfoB</td>
                            <td width="34%">InfoC</td>
                          </tr>
                        </table>
                  </div>
            </td>
            <td width="20" align="right">Yrs</td>
            <td width="10">x</td>
      </tr>
</table>

Please note that when the column is expanded, the table should exceed the size of the screen.  I noticed that the horizontal scrollbars do not appear at the bottom of the window when the DIV is displayed.
TheChosAsked:
Who is Participating?
 
raj3060Commented:
Define the table width how much you want it to be:
 e.g.
<table border="0" cellspacing="0" cellpadding="0" width="850">
0
 
raj3060Commented:
Try this:

<table border="0" cellspacing="0" cellpadding="0">
     <tr>
          <td width="150"><p style="margin-left: 15">Employee Name</td>
          <td width="150">Title</td>
          <td width="450" id="EmpInfo" style="display: block">              
                    <table border="0" width="100%" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="33%">InfoA</td>
                        <td width="33%">InfoB</td>
                        <td width="34%">InfoC</td>
                      </tr>
                    </table>              
          </td>
          <td width="100" align="right">Yrs</td>
          <td width="100">xyz</td>
     </tr>
</table>
0
 
raj3060Commented:
This should be 'none' at first:

<td width="450" id="EmpInfo" style="display: none">
0
 
TheChosAuthor Commented:
This almost works.  What appears to be happening is that when I expand the column, the table expands but only to the size of the screen.  It adjusts all the columns so that everything fits width-wise on the screen.  How can I make the table expand beyond the size of the screen?
0
 
TheChosAuthor Commented:
Thank you, it worked perfect!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.