title: How do I change the column width in a table using JavaScript?
body: <p>I'm trying to switch the width of two columns in a table when a user clicks on an image. I'm using a JavaScript on click even and if I put the new column width as % it works but it doesn't seem to work using px or em which is wht I want use to have better control over the columns. This is the code I'm using:</p>
  
  <pre><code>&lt;img alt="Change Widths" title="Switch column widths" src="/*images_path*/*image*.png" onclick="for (j=1;j&lt;=200;j++){document.getElementById('cola'+j).style.width = '60%'; document.getElementById('colb'+j).style.width = '28%';}" onmouseover="this.style.cursor='pointer';"/&gt;
  </code></pre>
  
  <p>I'm using Firefox is that makes a difference. Can anyone help me?</p>