开发者社区 问答 正文

怎样用js实现鼠标滑过时整行变色

要在一览画面里实现当鼠标滑过时整行变色,想问问用Js怎么实现?

展开
收起
小旋风柴进 2016-03-19 09:56:31 2049 分享 版权
1 条回答
写回答
取消 提交回答
  • function overIt(){ var the_obj = event.srcElement; if(the_obj.tagName.toLowerCase() == "td"){ the_obj=the_obj.parentElement; the_obj.oBgc=the_obj.currentStyle.backgroundColor; the_obj.oFc=the_obj.currentStyle.color; the_obj.style.backgroundColor='#71BAF0'; the_obj.style.color=''; } } function outIt(){ var the_obj = event.srcElement; if(the_obj.tagName.toLowerCase() == "td"){ the_obj=the_obj.parentElement; the_obj.style.backgroundColor=the_obj.oBgc; the_obj.style.color=the_obj.oFc; the_obj.style.textDecoration=''; } }
    2019-07-17 19:07:23
    赞同 展开评论