$(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输出来是什么啊。。
------解决方案--------------------