这次发一个简单点的,jQuery实现的上午发过一个纯JS实现的,各种麻烦链接如下:http://www.pin5i.com/showtopic-table%E9%BC%A0%E6%A0%87%E6%BB%91%E8%BF%87%E5%8F%98%E8%89%B2-%E5%8D%95%E5%87%BB%E5%8F%98%E8%89%B2-%E9%9A%90%E8%97%8F%E6%9F%90%E5%88%97%E7%9A%84%E6%96%B9%E6%B3%95.html 不得不再次感叹一下jQuery,真的就跟他的口号一样,不过,如果他不经常内存泄露,就完美了
  1. /** 
  2. * @标题 test.js
  3. * @包名 js
  4. * @项目 TestWeb
  5. * @描述 TODO table隔行变色,鼠标悬浮上方变色,鼠标单击变色
  6. * @作者 安家
  7. * @创建日期 Jun 6, 2013 9:54:40 PM
  8. */
  9. $(function () {
  10.     //获取table下的index大于0(把表头行去掉)的tr,绑定单击事件,鼠标悬浮事件
  11.     $("table tr:gt(0)").click(function(){
  12.         //给单击行增加click类样式,并将同一级的兄弟元素移去click类样式
  13.           $(this).addClass("click").siblings().removeClass("click");
  14.     }).mouseover(function () {
  15.         //绑定鼠标悬浮事件,同上
  16.         $(this).addClass("over").siblings().removeClass("over");
  17.     });
  18.     //给所有偶数行的tr增加类样式
  19.     $("table tr:gt(0):even").addClass("even");
  20. });
复制代码
Css如下
  1. .over{
  2.         cursor:pointer;
  3.         background-color: #ccc;
  4. }
  5. .even{
  6.         background-color: ffff00;
  7. }
  8. .click{
  9.         background-color: green;
  10. }
复制代码
TOP

谢谢分享!
women who cheat on husbands megaedd.com looking to cheat
why does husbands cheat blog.ivanovtech.com why husband cheat on their wife
TOP

谢谢分享!
cheat on your wife website read cheat on your wife website
cheat on my husband catching a cheater how do i know if my wife cheated
TOP

谢谢分享!
why my husband cheated on me damske.com my husband cheated on me blog
my husband almost cheated on me thesailersweb.com why men have affairs
why does husbands cheat blog.ivanovtech.com why husband cheat on their wife
TOP

回复 1# anjia 的帖子

谢谢楼主分享
TOP

谢谢楼主分享
TOP

顶起!谢谢分享。学习一下
married men having affairs developerstalk.com reason women cheat
women who cheat on husbands go looking to cheat
TOP

很高级,很受用
why my husband cheated on me link my husband cheated on me blog
all wife cheat what makes people cheat how to catch a cheater
TOP