$(function() {

$("table tr").mouseout( function()
 {
 
         alert("moveout ok"); 
  aliert($(this).attr("background"));   $(this).css({background:"#fff"});
 
   } ); 
 
 })这个为什么不执行alert("moveout ok")后面两句,就是aliert($(this).attr("background")); 
和$(this).css({background:"#fff"});
这样不行要怎样才可以,请高人指点这个我是做为头文件放在页首的即<script type="text/javascript" src="css.js"></script>
,就是希望每个表格都能够执行上面的样式,希望高人指点,急急,谢谢

解决方案 »

  1.   


    aliert($(this).attr("background"));  //这个aliert是什么东西?写错了?
      

  2.   

    aliert($(this).attr("background"));
    改为alert    $(this).css({background:"#fff"});
    改为
      $(this).css("background","#fff");
      

  3.   

    to zsx841021:还是不行,根本不能检查到 this 这个对象执行alert($(this).attr("background")); 提示没有定义我关键就是要执行$(this).css("background","#fff");这个
    但是怎样都不行,好像没有this这个对象
      

  4.   

    <html>
    <head>
    <title>test</title>
    <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
    <script>
    $(function(){
    $("tr").mouseout(function(){
    alert("moveout ok"); 
    $(this).css({"background":"blue"});//属性和值都是标上引号
    // $(this).css("background","#fff");//这样也可以的,一个属性就这样写简单点。
    alert($(this).attr("style"));//获取属性的值,如果元素没有相应属性,则返回 undefined。
    });  
    });
    </script>
    </head>
    <body>
    <table border=1 style="background:red;">
    <tr style="background:yellow;">
    <td>SSSS</td>
    <td>SS</td>
    </tr>
    <tr>
    <td>AA</td>
    <td>SS</td>
    </tr>
    <tr>
    <td>CC</td>
    <td>SS</td>
    </tr>
    </table>
    </body>
    </html>
      

  5.   

    <html>
    <head>
    <title>test</title>
    <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="test.js"></script>
    </head>
    <body>
        <table border=1 style="background:red;">
            <tr style="background:yellow;">
                <td>SSSS</td>
                <td>SS</td>
            </tr>
            <tr>
                <td>AA</td>
                <td>SS</td>
            </tr>
            <tr>
                <td>CC</td>
                <td>SS</td>
            </tr>
        </table>
    </body>
    </html>
    test.js
    $(function(){
        $("tr").mouseout(function(){
            alert("moveout ok"); 
            $(this).css({"background":"blue"});//属性和值都是标上引号
        //    $(this).css("background","#fff");//这样也可以的,一个属性就这样写简单点。
            alert($(this).attr("style"));//获取属性的值,如果元素没有相应属性,则返回 undefined。
        });  
    });
      

  6.   

     $("tabltr").mouseout( function()你这个选择器是不是写错了啊
      

  7.   

    $("tabltr").mouseout( function()这个没错的,里面的alert都执行,就是this对象就不行了
      

  8.   

    $(this).css("background","#ffe1e1");这个是什么颜色。。
    alert输出来是什么啊。。
      

  9.   

    $(this).css("background","#ffe1e1");
    鼠标移动到当前行,所要显示的颜色
      

  10.   

    是用来测试的,说未定义,即undefined