mousemat24
asked on
Use a different CSS class on the fly
Hi there
Wonder if you can help me, with a simple CSS/Javascript/HTML issue I have
I have this HTML:
<style>
.book
{
color: black;
font-size:10pt;
}
.book2
{
color: red;
font-size:10pt;
}
</style>
<table>
<tr>
<td class="book">
Book1
</td>
<tr>
<tr>
<td class="book">
Book2
</td>
<tr>
<tr>
<td class="book">
Book3
</td>
<tr>
<tr>
<td class="book">
Book4
</td>
<tr>
</table>
How can I change (swap) from class="book" to use class="book2" on the fly? i.e. using JavaScript
Thanks
Wonder if you can help me, with a simple CSS/Javascript/HTML issue I have
I have this HTML:
<style>
.book
{
color: black;
font-size:10pt;
}
.book2
{
color: red;
font-size:10pt;
}
</style>
<table>
<tr>
<td class="book">
Book1
</td>
<tr>
<tr>
<td class="book">
Book2
</td>
<tr>
<tr>
<td class="book">
Book3
</td>
<tr>
<tr>
<td class="book">
Book4
</td>
<tr>
</table>
How can I change (swap) from class="book" to use class="book2" on the fly? i.e. using JavaScript
Thanks
document.getElementById("o bjectID"). className = "newClassname";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks jello024!!