jQuery获取table动态的某行的值 50
<logic:iterateid="sh"name="lstShould"><tr><td><ahref="javascript:showMsg('this.value(...
<logic:iterate id="sh" name="lstShould">
<tr >
<td >
<a href="javascript:showMsg('this.value()')" value="${sh.fsSid}">${sh.fsSid}</a>
</td>
<td id="fdTypeId">${sh.fncMondatatype.fdType}</td>
<td id="fsDdate">${sh.fsDdate}</td>
<td id="ctId">${sh.clientInfo.ctId}</td>
<td id="llType">${sh.fncLob.llType}</td>
<td id="fsMgr">${sh.fsMgr}</td>
<td id="fpPid">${sh.fncPro.fpPid}</td>
<td id="fmCode">${sh.fncMontype.fmCode }</td>
<td id="fmSmt">${sh.fncMoney.fmSmt}</td>
<td id="fsShould">${sh.fsShould}</td>
<td id="frRate">${sh.fncRate.frRate}</td>
<td id="frRmb">${sh.fncRate.frRmb}</td>
<td id="fckName">${sh.fncCktype.fckName}</td>
<td id="fgName">${sh.fncGetcondition.fgName}</td>
<td id="edName">${sh.empDept.edName}</td>
<td id="fsRemark">${sh.fsRemark}</td>
</tr>
</logic:iterate>
这是我的表
我想当我点击<a href="javascript:showMsg('this.value()')" value="${sh.fsSid}">${sh.fsSid}</a>链接时
用jQuery一一获取我点击的这行的所有td里面的值 。。 展开
<tr >
<td >
<a href="javascript:showMsg('this.value()')" value="${sh.fsSid}">${sh.fsSid}</a>
</td>
<td id="fdTypeId">${sh.fncMondatatype.fdType}</td>
<td id="fsDdate">${sh.fsDdate}</td>
<td id="ctId">${sh.clientInfo.ctId}</td>
<td id="llType">${sh.fncLob.llType}</td>
<td id="fsMgr">${sh.fsMgr}</td>
<td id="fpPid">${sh.fncPro.fpPid}</td>
<td id="fmCode">${sh.fncMontype.fmCode }</td>
<td id="fmSmt">${sh.fncMoney.fmSmt}</td>
<td id="fsShould">${sh.fsShould}</td>
<td id="frRate">${sh.fncRate.frRate}</td>
<td id="frRmb">${sh.fncRate.frRmb}</td>
<td id="fckName">${sh.fncCktype.fckName}</td>
<td id="fgName">${sh.fncGetcondition.fgName}</td>
<td id="edName">${sh.empDept.edName}</td>
<td id="fsRemark">${sh.fsRemark}</td>
</tr>
</logic:iterate>
这是我的表
我想当我点击<a href="javascript:showMsg('this.value()')" value="${sh.fsSid}">${sh.fsSid}</a>链接时
用jQuery一一获取我点击的这行的所有td里面的值 。。 展开
3个回答
展开全部
既然是获取TD的值 那就加入td的id为tdv 它的值就为$("#tdv").text();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
给tr一个id为aaa,
var str="";
$("#aaa").children("td").each(function(){
str+=$(this).text()+",";
});
alert(str);
var str="";
$("#aaa").children("td").each(function(){
str+=$(this).text()+",";
});
alert(str);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
代码如下,你自己试验一下。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>getSelectedTDsContents</title>
<script type="text/javascript" language="JavaScript" src="../script/jquery-1.2.6.js"></script>
<script type="text/javascript" language="JavaScript">
var $j = jQuery;
<!--
function getSelectedTDs(o) {
var tds = $j(o.parentNode.parentNode);
var contents = tds.find("td");
var contentText = "";
for(var i = 0, j = contents.size();i<j;i++) {
if(i!=0)
contentText +=" "+ contents[i].innerHTML;
}
alert(contentText);
}
//-->
</script>
</head>
<body>
<table border="1">
<tr>
<td>
<a href="####" onclick="getSelectedTDs(this);void(0);" >get Selected TDs Content</a>
</td>
<td id="fdTypeId">fdTypeId</td>
<td id="fsDdate">fsDdate</td>
<td id="ctId">ctId</td>
<td id="llType">llType</td>
<td id="fsMgr">fsMgr</td>
<td id="fpPid">fpPid</td>
<td id="fmCode">fmCode</td>
<td id="fmSmt">fmSmt</td>
<td id="fsShould">fsShould</td>
<td id="frRate">frRate</td>
<td id="frRmb">frRmb</td>
<td id="fckName">fckName</td>
<td id="fgName">fgName</td>
<td id="edName">edName</td>
<td id="fsRemark">fsRemark</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>getSelectedTDsContents</title>
<script type="text/javascript" language="JavaScript" src="../script/jquery-1.2.6.js"></script>
<script type="text/javascript" language="JavaScript">
var $j = jQuery;
<!--
function getSelectedTDs(o) {
var tds = $j(o.parentNode.parentNode);
var contents = tds.find("td");
var contentText = "";
for(var i = 0, j = contents.size();i<j;i++) {
if(i!=0)
contentText +=" "+ contents[i].innerHTML;
}
alert(contentText);
}
//-->
</script>
</head>
<body>
<table border="1">
<tr>
<td>
<a href="####" onclick="getSelectedTDs(this);void(0);" >get Selected TDs Content</a>
</td>
<td id="fdTypeId">fdTypeId</td>
<td id="fsDdate">fsDdate</td>
<td id="ctId">ctId</td>
<td id="llType">llType</td>
<td id="fsMgr">fsMgr</td>
<td id="fpPid">fpPid</td>
<td id="fmCode">fmCode</td>
<td id="fmSmt">fmSmt</td>
<td id="fsShould">fsShould</td>
<td id="frRate">frRate</td>
<td id="frRmb">frRmb</td>
<td id="fckName">fckName</td>
<td id="fgName">fgName</td>
<td id="edName">edName</td>
<td id="fsRemark">fsRemark</td>
</tr>
</table>
</body>
</html>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询