Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to change width of <td> from javascript?

Status
Not open for further replies.

heeeep72

Programmer
Dec 15, 2004
33
CH
Hi All,

A simple question:
Can I change the width of a <td>, from javascript?
Is it possible? If yes, how?

thx in advance
 
Code:
<table width="100%" bgcolor="green">
<tr>
<td id="wtd" width="50%" style="border:red 5px groove" onclick="wchg();">
test
</td>
<td width="50%" style="border:yellow 5px groove">
test2
</td>
</tr>
</table>

<script>
function wchg(){
document.getElementById('wtd').style.width = '10%';
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top