日期:2014-05-16  浏览次数:20518 次

disabled和onmouseover的问题,送分了!!!
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  
<html   xmlns= "http://www.w3.org/1999/xhtml ">  
<head>  
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />  
<title> 无标题文档 </title>  
<script>  
var   _h=null  
function   hit(){  
var   e=event.srcElement  
if(e.tagName!= "TD ")return;  
if(!_h)_h=e.parentElement;  
_h.style.backgroundColor= ' ';  
_h.style.color= ' '  
_h=e.parentElement;  
_h.style.backgroundColor= '#f0dad2 '  
_h.style.color= '#000 '  
}  
</script>  
</head>  

<body>  
<table   width= "100% "   border= "1 "   cellpadding= "0 "   cellspacing= "0 "   bordercolor= "#993333 "   onmouseover= "hit() ">  
<tr>  
<td>   </td>  
<td>   </td>  
</tr>  
<tr>  
<td> <input   name= "提交 "   type= "submit "   value= "1111 "   disabled= "disabled "/> </td>  
<td> <input   name= " "   type= "button "   value= "1111 "   disabled= "disabled "   /> </td>  
</tr>  
</table>  
</body>  
</html>  
先测试一下,为什么当鼠标快速来回滑过按钮的时候,会报错,但是当按钮上没有disabled送时候,就不会报错,请高手解决!!!


------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
<script>
var _h=null
function hit(){
var e=event.srcElement;
if(!e) return;
if(e.tagName!= "TD ") return;
if(!_h)_h=e.parentElement;
_h.style.backgroundColor= ' ';
_h.style.color= ' '
_h=e.parentElement;
_h.style.backgroundColor= '#f0dad2 '
_h.style.color= '#000 '
}
</script>
</head>

<body>
<table width= "100% " border= "1 " cellpadding= "0 " cellspacing= "0 " bordercolor= "#993333 " onmouseover= "hit() ">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> <input name= "提交 " type= "submit " value= "1111 " disabled= "disabled "/> </td>
<td> <input name= " " type= "button " value= "1111 " disabled= "disabled " /> </td>
</tr>
</table>
</body>
</html>