sugar2
05-18-2005, 02:48 AM
im trying to add a class name in a exsisting TD tag of a HTML table.
this code doesnt print any errors but dont add the class either...
<SCRIPT>
function changeclass() {
var NAME = document.getElementsByTagName("TD")
NAME.className="items"
}
</SCRIPT>
<a href="#" onclick="changeclass();">TEST</a>
and this is my table sample wich have no class asigned, it is waiting for the script who is supposed will add it a neww class
<style>
TD.items {COLOR: 000;}
TD.items A:link {COLOR: blue; font-weight: bold;}
TD.items A:visited {COLOR: blue; font-weight: bold;}
TD.items A:active {COLOR: blue; font-weight: bold;}
TD.items A:hover {COLOR: #505C6D; font-weight: bold;}
</style>
<table>
<tr>
<td><a href="http://somewhere.com"><b>my custom text</a></td>
</tr>
</table>
any help will be apreciated
thanks
this code doesnt print any errors but dont add the class either...
<SCRIPT>
function changeclass() {
var NAME = document.getElementsByTagName("TD")
NAME.className="items"
}
</SCRIPT>
<a href="#" onclick="changeclass();">TEST</a>
and this is my table sample wich have no class asigned, it is waiting for the script who is supposed will add it a neww class
<style>
TD.items {COLOR: 000;}
TD.items A:link {COLOR: blue; font-weight: bold;}
TD.items A:visited {COLOR: blue; font-weight: bold;}
TD.items A:active {COLOR: blue; font-weight: bold;}
TD.items A:hover {COLOR: #505C6D; font-weight: bold;}
</style>
<table>
<tr>
<td><a href="http://somewhere.com"><b>my custom text</a></td>
</tr>
</table>
any help will be apreciated
thanks