$(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>
,就是希望每个表格都能够执行上面的样式,希望高人指点,急急,谢谢
$("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>
,就是希望每个表格都能够执行上面的样式,希望高人指点,急急,谢谢
aliert($(this).attr("background")); //这个aliert是什么东西?写错了?
改为alert $(this).css({background:"#fff"});
改为
$(this).css("background","#fff");
但是怎样都不行,好像没有this这个对象
<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>
<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。
});
});
alert输出来是什么啊。。
鼠标移动到当前行,所要显示的颜色