<!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 src="jquery-1.3.1.js" type="text/javascript">
</script>
</head><body>
<table width="600" border="0" cellspacing="0" cellpadding="0" id="tb1">
  <tr>
    <td width="100"><div align="center">首页</div></td>
    <td width="100"><div align="center">新闻</div></td>
    <td width="100"><div align="center">公告</div></td>
    <td width="100">&nbsp;</td>
    <td width="100">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<script language="javascript">
$("#tb1 td").mouseover(function(){
$(this).attr("bgcolor","#990000");
});
$("#tb1 td").mouseout(function(){
$(this).removeAttr("bgcolor");
});
</script>
</body>
</html>
firefox或搜狗兼容模式可以,ie下却没反应,也不报错

解决方案 »

  1.   


    $("#tb1 td").mouseover(function(){
    $(this).css("background","#990000");
    });
    $("#tb1 td").mouseout(function(){
    $(this).css("background","");
    });
      

  2.   

    鼠标移入移出,直接用hover$("#tb1 td").hover(function(){
    $(this).css("background","#990000");
    },
    function(){
    $(this).css("background","");
    });
      

  3.   

    在我这无效,ie7 ffjquery-1.3.1.js 哪有css的语法
      

  4.   

    新版也兼容attr方法和mouseover mouseout吧,可不兼容在哪呢