Click to See Complete Forum and Search --> : How to Resize <td id='xyz'> via javascript
Ali Imran
07-31-2003, 05:05 AM
I have a table and one of its data cell (<td id='xyz'>) needs to be changed when a button clicked
please changed the following code if possible
<table>
<tr>
<td width='100px' height='50px'>
this is my Table Data
</td>
</tr>
</table>
<input type=button value='click here' onclick ="">
what to put in (onclick ="") to change <td id=xyz> height to 200px ?
waiting for sooner reply...
regards
Ali Imran
xataku_nakusute
07-31-2003, 05:14 AM
<script type="text/javascript">
function resize()
{
xyz.height = '200px';
}
</script>
<table>
<tr>
<td id="xyz" width='100px' height='50px'>
this is my Table Data
</td>
</tr>
</table>
<input type="button" value="click here" onclick="resize()">
Gollum
07-31-2003, 05:14 AM
try...
document.getElementById('xyz').height = 200;
Ali Imran
07-31-2003, 09:36 AM
And How to display height of a layer (<div id='xyz'>) in an alert messagebox ?
Ali Imran
07-31-2003, 09:51 AM
Not accpeting the property .height
what to do ?
It depends. If you are setting the height with CSS, and just need to get that value, you can use:
document.getElementById("theid").style.height;
But, if the height expands (due to content) you will want to use something like this:
document.getElementById("theid").offsetHeight
Ali Imran
07-31-2003, 10:01 AM
Is it possible if I set this id to the table instead if <td>
whill this be working fine to changed entire table height ?
Yep, that should work fine.
Ali Imran
07-31-2003, 10:08 AM
thank I figured it out ..
so many thanks to this community developers....
You bet. Glad you got it working. :)