Javascript to set height of table?

Is there any way of using a javascript to set the height of a table? I’ve tried this, but it doesn’t work…

function setTableHeight(tableID, newHeight) {
  window.document.getElementByID(tableID).height = newHeight;

and then on the link:

j a v a s c r i p  t :setTableHeight('mainTable', '600');

and the table is like this:

< table width="580" border="0" cellpadding="0" cellspacing="0" id="mainTable" >
  < tr > 
    < td height="1" align="center" valign="middle" bgcolor="#0099CC" >< / td > 
  < / tr >
< / table >