二、操作
1.鼠标移动行变色
$("#table1 tr").hover(function(){
$(this).children("td").addClass("hover")
},function(){
$(this).children("td").removeClass("hover")
})
$("#table2 tr:gt(0)").hover(function() {
$(this).children("td").addClass("hover");
}, function() {
$(this).children("td").removeClass("hover");
});
2.奇偶行不同颜色
$("#table3 tbody tr:odd").css("background-color", "#bbf");
$("#table3 tbody tr:even").css("background-color","#ffc");
$("#table3 tbody tr:odd").addClass("odd")
$("#table3 tbody tr:even").addClass("even")
3.隐藏一行
$("#table3 tbody tr:eq(3)").hide();
4.隐藏一列
$("#table5 tr td::nth-child(3)").hide();
$("#table5 tr").each(function(){$("td:eq(3)",this).hide()});
5.删除一行
// 删除除第一行外的所有行
$("#table6 tr:not(:first)").remove();
6.删除一列
// 删除除第一列外的所有列
$("#table6 tr td:not(:nth-child(1))").remove();
7.得到(设置)某个单元格的值
//设置table7,第2个tr的第一个td的值。
$("#table7 tr:eq(1) td:nth-child(1)").html("value");
//获取table7,第2个tr的第一个td的值。
$("#table7 tr:eq(1) td:nth-child(1)").html();
8.插入一行:
//在第二个tr后插入一行
$("<tr><td>插入3</td><td>插入</td><td>插入</td><td>插入</td></tr>").insertAfter($("#table7 tr:eq(1)"));
来自:Forgot.
分享到:
相关推荐
Jquery学习 Jquery源代码 Jquery数据库操作 Jquery学习 Jquery源代码 Jquery数据库操作 绝对有用,技术含量
Jquery各种连接操作 Ajax JqueryJquery各种连接操作 Ajax Jquery
jQuery操作文件夹
jquery表格操作实例jquery表格操作实例jquery表格操作实例jquery表格操作实例
Jquery操作xml_Demo。 帮一个朋友做的一个Demo实例,用jquery读取xml文件,很简单的操作,一看就明白。
jQuery 文档操作方法详细列表,里面列出常用的jQuery 文档操作方法语法并且做了详细的说明,是一个不错工具书。
jquery常用操作.pdf
jQuery第4天知识点:jQuery节点操作、jQuery特殊属性操作、jQuery事件机制.zip
JQuery DoM和ajax 操作大全源码
jquery常用操作,jquery一些常用的操作,很实用哦
内容包括:jQuery Ajax 操作函数,jQuery 选择器,jQuery 事件处理方法,jQuery 事件方法,jQuery 效果函数,jQuery 文档操作方法,jQuery 属性操作方法,jQuery CSS 操作函数,jQuery 遍历函数
NULL 博文链接:https://kingschan.iteye.com/blog/1513128
可以实现主表与从表的关系,例如:一张单据可以由两批货物在页页上显示,都通过JQuery实现的
JQuery对cookie操作。可判断是否存在cookie,可对cookie进行新建,删除,是否存在进行判断。
使用Jquery实现下拉级联操作。 JSP+Jquery+JAVA+sql2005_sql
jQuery select checkbox radio等基本操作,包括的取值
jQueryDemo(JQuery常用操作2005)jQueryDemo(JQuery常用操作2005)jQueryDemo(JQuery常用操作2005)
jQuery第2天知识点:jQuery 样式操作、jQuery 属性操作.zip
工作中常用的jQuery表单操作:$("input[name='checkbox_name'][checked]"); //选择被选中CheckBox元素的集合 $("#checkbox_id").attr("checked",true);设置一个CheckBox的状态为选中
jQuery 操作 Form 元素 v1.0 for jQuery1.4.2,IE7/FF3.6.2下测试通过 作者:西安 网眼 博客:http://blog.why100000.com 微博:http://t.qq.com/zhangking 西安PHP教育培训中心 2010-6-20