admin管理员组文章数量:1426648
I want to add a background color on a td
as a mouse hover in smarty.
How can I use create a hover I made a class for hover but its not working.
Help me out
I want to add a background color on a td
as a mouse hover in smarty.
How can I use create a hover I made a class for hover but its not working.
Help me out
Share Improve this question edited Feb 21, 2011 at 8:18 Hussein 42.8k25 gold badges115 silver badges143 bronze badges asked Feb 21, 2011 at 5:42 SunnySunny 51 silver badge4 bronze badges 1- Can you show us what you tried that is not working? – Muhammad Akhtar Commented Feb 21, 2011 at 5:44
4 Answers
Reset to default 7see the css :hover selector.
In your case:
td.yourClass { background-color: transparent; }
td.yourClass:hover { background-color: red; /* for example */ }
Live demo
<SCRIPT language="JavaScript">
function rollbg(chosen, objectID) {
if(chosen == "roll") {
document.getElementById(objectID).className="roll";
}
else {
document.getElementById(objectID).className="over";
}
}
</SCRIPT>
<STYLE>
.hlink {
display block;
height:20px;
width:75px;
color:black;
background-color:white;
text-align:center;
text-decoration:none;
}
.hlink:hover {
color:white;
background-color:black;
}
</STYLE>
You can try this....
<style>
td.navon {
background-color: #999999;
cursor: hand}
td.navoff {
background-color: #FFFFFF}
</style>
<table>
<tr>
<td class="navoff" onmouseover="className='navon'" onmouseoff="className='navoff'">
td 1
</td>
</tr>
<tr>
<td class="navoff" onmouseover="className='navon'" onmouseoff="className='navoff'">
td 2
</td>
</tr>
</table>
Here you go
td{
background:red;
color:white;
padding:10px;
border:1px solid white;
}
td:hover{
background:blue;
}
<table>
<tr>
<td>test</td>
<td>test</td>
</tr>
</table>
Check working example at http://jsfiddle/LU9b7/1/
本文标签: javascriptcoloring a td on mouse hoverStack Overflow
版权声明:本文标题:javascript - coloring a td on mouse hover - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745460332a2659295.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论