日期:2014-05-17  浏览次数:21103 次

当鼠标放到某一行时为什么不改变颜色
<Script   Language= "javascript ">
function     mOvr(src,clrOver){
if(!src.contains(event.fromElement)){
  src.style.cursor= 'hand ';
  src.bgcolor=clrOver;

}
}
function   mOut(src,clrIn){
if(!src.contains(event.toElement)){
  src.style.cursor= 'default ';
src.bgcolor=clrIn;

}
}
</script>


------解决方案--------------------
<script language= "JavaScript ">
var searchResult=new Array();//鼠标滑过时显示背景色
function borderize(what,color,color2)
{
what.style.borderColor=color
what.style.backgroundColor=color2
}

function borderize_on(e){
if (document.all)
source3=event.srcElement
else if (document.getElementById)
source3=e.target
if (source3.className== "zuo22 "){
borderize(source3, "#999999 ", "#000000 ")
}
else{
while(source3.tagName!= "TABLE "){
source3=document.getElementById? source3.parentNode : source3.parentElement
if (source3.className== "zuo22 ")
borderize(source3, "#999999 ", "#F6F6F8 ")
}
}
}

function borderize_off(e){

if (document.all)
source4=event.srcElement
else if (document.getElementById)
source4=e.target
if (source4.className== "zuo22 ")
borderize(source4, "white ", "white ")
else{
while(source4.tagName!= "TABLE "){
source4=document.getElementById? source4.parentNode : source4.parentElement
if (source4.className== "zuo22 ")
borderize(source4, "white ", "white ")
}
}
}
</script>

<body >
<table width= "96% " border= "0 " onMouseOver= "borderize_on(event) " onMouseOut= "borderize_off(event) " class= "zuo22 " onclick= "javascript:clickfun( '123 ') ">
<TR>
<TD> 把鼠标移过来 </TD>
<TD> 把鼠标移过来 </TD>
</TR>
</table>