$(document).ready(function() {
$("input[name='btn']").click(function() {
var ck = $(" input:checked").parent().parent();
var elb_id = "";
var bookname = "";
var publisher = "";
var jh = "";
var qh = "";
var content = "";
$(ck).each(function() {
if ($(this).children("td:nth-child(3)").text() != "") {
elb_id += $(this).children("td:nth-child(3)").text() + ",";
}
});
if ($(this).children("tr td:first-child").eq(4).text() != "") {
bookname = $(this).children(" tr td:first-child").eq(4).text();
}
alert(bookname);
if ($(ck).children("tr td:first-child").eq(8).text() != "") {
publisher = $(ck).children("tr td:first-child").eq(8).text();
}
//alert(publisher);
if ($(ck).children("tr td:first-child").eq(9).text() != "") {
content = $(ck).children("tr td:first-child").eq(9).text();
}
// alert(content);
$(ck).each(function() {
if ($(this).children("td:nth-child(7)").text != "") {
qh += $(this).children("td:nth-child(7)").text() + ",";
}
});
// alert(qh);
$(ck).each(function() {
if ($(this).children("td:nth-child(8)").text() != "") {
jh += $(this).children("td:nth-child(8)").text() + ",";
}
});
//alert(jh);
});
});小弟分少,请各位大侠原谅
$("input[name='btn']").click(function() {
var ck = $(" input:checked").parent().parent();
var elb_id = "";
var bookname = "";
var publisher = "";
var jh = "";
var qh = "";
var content = "";
$(ck).each(function() {
if ($(this).children("td:nth-child(3)").text() != "") {
elb_id += $(this).children("td:nth-child(3)").text() + ",";
}
});
if ($(this).children("tr td:first-child").eq(4).text() != "") {
bookname = $(this).children(" tr td:first-child").eq(4).text();
}
alert(bookname);
if ($(ck).children("tr td:first-child").eq(8).text() != "") {
publisher = $(ck).children("tr td:first-child").eq(8).text();
}
//alert(publisher);
if ($(ck).children("tr td:first-child").eq(9).text() != "") {
content = $(ck).children("tr td:first-child").eq(9).text();
}
// alert(content);
$(ck).each(function() {
if ($(this).children("td:nth-child(7)").text != "") {
qh += $(this).children("td:nth-child(7)").text() + ",";
}
});
// alert(qh);
$(ck).each(function() {
if ($(this).children("td:nth-child(8)").text() != "") {
jh += $(this).children("td:nth-child(8)").text() + ",";
}
});
//alert(jh);
});
});小弟分少,请各位大侠原谅
解决方案 »
- jsp 中为什么修改不了个人信息啊
- 如何理解 JavaScript 中作为参数的函数的作用域和 this?
- 如何统计数据整和,求解决方案,目前的思路是循环遍历,但是具体不知道如何写好,跪求高手解答。
- 疯了,setAttribute(key,value)方法的问题。急
- 寻一段js读取xml信息的例子来学习
- 菜鸟问题:请教一个onmouseover事件的问题
- 怎样知道页面中iframe中的页面已经下载完毕呢?
- 请高手赐教!
- 在框架里我左边是菜单,右边添加项目后,怎样做到左边的菜单页自动更新呢?
- 如何在angularjs的ng-repeat中对日期格式进行格式化?
- 类似sina博客的消息提示框特效
- 如何使用JQuery获取对象的所有属性名称
ck.each(function() {//ck是jquery对象不用转换的$(ck)
if ($(this).children("td:nth-child(8)").text() != "") {
jh += $(this).children("td:nth-child(8)").text() + ",";
}
});orck.each(function() {//ck是jquery对象不用转换的$(ck)
if ($(this).find("td:eq(8)").text() != "") {
jh += $(this).find("td:eq(8)").text() + ",";
}
});
if ($(this).children("td:nth-child(8)").text() != "") {
jh += $(this).children("td:nth-child(8)").text() + ",";
}
});orck.each(function() {//ck是jquery对象不用转换的$(ck)
if ($(this).find("td:eq(8)").text() != "") {
jh += $(this).find("td:eq(8)").text() + ",";
}
});-----------------------------------------------------
用nth-child 它把表格中所有选中的child(8)都得到了,而我要做的是,不管选中多少我就只要表格中第一行为child(8)那一列的数据
ck.parent().find(tr:eq(0)).find("td:eq(8)").text();
or
ck.parent().find(tr:eq(0)).children("td:nth-child(8)").text();