Jump to content

change width of css id style html tag...


RIRedinPA

Recommended Posts

if that is in your head section try

windows.onload=function(){
  document.getElementById('tableheader').style.width = "2000px" 
}

 

No, I should have given more details, I'm making a scrollable table with fixed headers that has two views, art and editorial. The art view is 2000px wide, the editorial is 1500px. I have a toggle button which lets the viewers switch between views...here's my html set up:

 

<div id="tableheader">

<table cellpadding='3' cellspacing='0' border='0'> 
<tr>
<td>...stuff...</td>
<!--...more cells...-->
</tr>
</table>

</div>

<div id="etable" style="display: block;">
<table cellpadding='3' cellspacing='0' border='0'> 
<tr>
<td>...stuff...</td>
<!--...more cells...-->
</tr>
</table>

</div>

 

I set the width of the tableheader div initially in my styles:

 

#tableheader table {

width: 1500px;

}

 

I then need to change it in javascript depending on which view is toggled. Does that make sense?

 

Link to comment
Share on other sites

Reread my post.

 

Re-write your post.

 

Are you not trying to change the width of a table that has the ID of #tableheader? Then you do it with the code I gave you. If you aren't trying to do that, then try explaining what you want, because your initial post didn't do it very well.

Link to comment
Share on other sites

Reread my post.

 

Re-write your post.

 

Are you not trying to change the width of a table that has the ID of #tableheader? Then you do it with the code I gave you. If you aren't trying to do that, then try explaining what you want, because your initial post didn't do it very well.

 

Sorry, I was assuming you read all the post in the thread, I was referring to my reply to Dj and wasn't trying to be snide, my bad...I am trying to resize the width of a table within the div that has the id "tableheader"

 

#tableheader table {

width: 1500px;

}

 

I need to be able to toggle this to either 1500 or 2000px but I don't want to resize the div, just the table within.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.