我想改变css的字体。
<div id="a" onmouseover="chbg('red','b')" onmouseout="chbg('white','b')">This will change b element</div>
<div id="b">This is element b</div>
<div id="f" onmouseover="chbg('blue','g')" onmouseout="chbg('white','g')">This will change g element</div>
<div id="g">This is element g</div>
<div id="j" onmouseover="chbg('yellow','k')" onmouseout="chbg('white','k')">This will change k element</div>
<div id="k">This is element k</div>据我所知,这是用“chbg”来改变背景色,
如果我想使字体下划线+字体颜色,我如何应用于此。
这里是活生生的小提琴http://jsfiddle.net/NAuxn/
发布于 2014-07-24 05:57:31
使用此函数,您可以更改字体颜色和下划线:http://jsfiddle.net/NAuxn/4/
function chbg(color, id) {
document.getElementById(id).style.color = color;
document.getElementById(id).style.textDecoration = "underline";
}https://stackoverflow.com/questions/24926055
复制相似问题