# Javascript to set height of table?

**URL:** <https://forum.kirupa.com/t/javascript-to-set-height-of-table/39730>\
**Category:** web dev\
**Created:** [January 10, 2004, 12:37pm UTC](https://forum.kirupa.com/t/javascript-to-set-height-of-table/39730 "2004-01-10T12:37:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScriptFlipper](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@ScriptFlipper](https://forum.kirupa.com/u/ScriptFlipper)\
**Post date:** [January 10, 2004, 12:37pm UTC](https://forum.kirupa.com/t/javascript-to-set-height-of-table/39730/1 "2004-01-10T12:37:48Z")

</div>

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

```auto

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

```

and then on the link:

```auto

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

```

and the table is like this:

```auto

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

```

greetings  
Kalliban
