首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

小弟我有一函数不执行$(this),$("table tr").mouseout( function(){aliert($(this).at

2012-04-17 
我有一函数不执行$(this),$(table tr).mouseout( function(){aliert($(this).attr(backgro}$(function(

我有一函数不执行$(this),$("table tr").mouseout( function(){aliert($(this).attr("backgro}
$(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>
,就是希望每个表格都能够执行上面的样式,希望高人指点,急急,谢谢

[解决办法]

JScript code
aliert($(this).attr("background"));  //这个aliert是什么东西?写错了?
[解决办法]
aliert($(this).attr("background"));
改为alert

$(this).css({background:"#fff"});
改为
$(this).css("background","#fff");
[解决办法]
HTML code
<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>
[解决办法]
HTML code
<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>
[解决办法]
探讨

晕,为什么我的就不行,难道因为是脚本生成的表格

[解决办法]
我写了一个测试一下没有你说的那个问题
[解决办法]
$("tabltr").mouseout( function()你这个选择器是不是写错了啊
[解决办法]
$(this).css("background","#ffe1e1");这个是什么颜色。。
alert输出来是什么啊。。
------解决方案--------------------


探讨

???

[解决办法]
你先用最简短的语言还原你的整个情景吧,说不定就找到原因了

热点排行