jquery获取行的值,为什么得到的是为空值。
我代码如下:<scripttype="text/javascript"language="javascript">$(function(){$("#Button1").c...
我代码如下:
<script type="text/javascript" language="javascript">
$(function () { $("#Button1").click(function () { var showTxt = ""; $("#tb tr").each(function () {
// var text = $(this).children("td:eq").text(); var td_text1 = $(this).children("td:eq(0)").text(); var td_text2 = $(this).children("td:eq(1)").text(); var td_text3 = $(this).children("td:eq(2)").text(); var td_text4 = $(this).children("td:eq(3)").text(); var td_text5 = $(this).children("td:eq(4)").text(); var td_text6 = $(this).children("td:eq(5)").text(); var td_text7 = $(this).children("td:eq(6)").text(); showTxt += td_text1 + "," + td_text2 + "," + td_text3 + "," + td_text4 + "," + td_text5 + "," + td_text6 + "," + td_text7+"|";
// cols += showTxt + "|"; }) showTxt = showTxt.length > 0 ? showTxt.substring(0, showTxt.length - 1) : ""; alert(showTxt); }) })
获取的值截图如下: 展开
<script type="text/javascript" language="javascript">
$(function () { $("#Button1").click(function () { var showTxt = ""; $("#tb tr").each(function () {
// var text = $(this).children("td:eq").text(); var td_text1 = $(this).children("td:eq(0)").text(); var td_text2 = $(this).children("td:eq(1)").text(); var td_text3 = $(this).children("td:eq(2)").text(); var td_text4 = $(this).children("td:eq(3)").text(); var td_text5 = $(this).children("td:eq(4)").text(); var td_text6 = $(this).children("td:eq(5)").text(); var td_text7 = $(this).children("td:eq(6)").text(); showTxt += td_text1 + "," + td_text2 + "," + td_text3 + "," + td_text4 + "," + td_text5 + "," + td_text6 + "," + td_text7+"|";
// cols += showTxt + "|"; }) showTxt = showTxt.length > 0 ? showTxt.substring(0, showTxt.length - 1) : ""; alert(showTxt); }) })
获取的值截图如下: 展开
3个回答
展开全部
你检查下代码。
追问
- - 觉得没错才来问的..
追答
额。。好吧。觉得代码问题不大。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询