要在一览画面里实现当鼠标滑过时整行变色,想问问用Js怎么实现?
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=''; } }你说的table吗?鼠标悬浮事件
如果是table,就在mousedown的时候获取当前焦点的元素,判断是不是tr,如果是tr则设置style。在mouseup的时候移除style。其他的话就是其他的办法了