jquery 添加onmouseover 事件 $("#testtab tr:eq(1)").addClass("bgcolor");因为你写的就是将tr的第一行变色啊直接$("#testtab tr ").addClass("bgcolor"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $(function() { $("#testtab tr").mouseover(function() { this.className="bgcolor"; }); }); 或者$(function() { $("#testtab tr").mouseover(function() { $(this).addClass("bgcolor"); }); });都可以。 太简单了:$("#testtab>tr").mouseover(function(){ $(this).addClass("bgcolor");}, function() { $(this).removeClass("bgcolor");});注意,mouseover 方法有两个 function 参数。 $(document).ready(function() {$("#testtab tr").hover( function () { $(this).addClass("bgcolor"); }, function () { $(this).removeClass("bgcolor"); });}); 在jquery的实践函数中,this都可以指向当前的对象$("#testtab tr").onmouseover(function(){ $(this).toggleClass("bgcolor");},function(){ $(this).toggleClass("bgcolor");}); 发布一款树控件:fly.simple.Tree 如何做到语音数字读取呢 Javascript解析图片文件 PHP结合JS的日期联动问题 二维数组的传递问题 内容显示不出来? 能用javascript在页面上创建新层吗? highchart 中seriesundefined的问题 有没有什么方法防止我框架里面的页面使用了top.location=self.location 急!!!!!!在线等! 一个XPATH问题 ▲▲ 如何选择不含某属性的节点? 如何用js 将htm网页中的表格导出成word或excel?
$("#testtab tr").mouseover(function() {
this.className="bgcolor";
});
});
$(function() {
$("#testtab tr").mouseover(function() {
$(this).addClass("bgcolor");
});
});都可以。
$("#testtab>tr").mouseover(function(){
$(this).addClass("bgcolor");
}, function() {
$(this).removeClass("bgcolor");
});
注意,mouseover 方法有两个 function 参数。
function () {
$(this).addClass("bgcolor");
},
function () {
$(this).removeClass("bgcolor");
}
);
});
$("#testtab tr").onmouseover(function(){
$(this).toggleClass("bgcolor");
},function(){
$(this).toggleClass("bgcolor");});