ASP中如何修改子标签的样式

来源:百度知道 编辑:UC知道 时间:2024/05/06 18:44:19
<table>
<tr>
<Td bgcolor=#BECDD2 colspan="2" onmouseover="this.style.background='url({%picurl%}/hover.jpg) no-repeat';this.style.color='black';" onmouseout="this.style.background='#BECDD2 none';this.style.color='#435A6C';">
<h1 style="color:red">最新推荐</h1>
</Td></tr>
</table>

目前状况:我需要当鼠标移动到td中的时候,td的背景显示图片,并且h1中的字体颜色变为黑色。但是h1本身也有样式,因此在td中设置color是无效的。
问题:如何将h1的字体颜色改变,但不使用<a>标记。
两位的答案我看过了,可是在变换样式之前我还希望保持原来的颜色,如果写<h1 style="color:red">最新推荐</h1>字体就总是红色的了,而我希望只在鼠标划过的时候才改变颜色。
不过仍然谢谢大家为我提供方案。

修改后的代码如下:
<table>
<tr>
<Td bgcolor=#BECDD2 colspan="2" onmouseover="this.style.background='url({%picurl%}/hover.jpg) no-repeat';this.childNodes[0].style.color='black';" onmouseout="this.style.background='#BECDD2 none';this.childNodes[0].style.color='red';">
<h1 style="color:red">最新推荐</h1>
</Td></tr>
</table>

<h1><font color="#ff0099">红色</font></h1>