首页 > 其他 > 详细

table内 获取同一行 其他列的value

时间:2014-05-26 20:35:49      阅读:399      评论:0      收藏:0      [点我收藏+]

table内  获取同一行 其他列的value

 

bubuko.com,布布扣
function move(obj,ud){
        var code =  document.getElementById("reportName");
        var year = document.getElementById("reportYear");
        var tr= obj.parentNode.parentNode;            
        var cells = tr.cells;    
        var targetcode = cells[3].childNodes[0].value;
        
        document.getElementById("targetCodeSelect").value = targetcode; //targetCode传参
        if (ud==‘1‘) {//up            
            document.getElementById("upOrDown").value = ‘1‘;            
        }
        if(ud==‘2‘){//down            
            document.getElementById("upOrDown").value = ‘2‘;            
        }
        document.getElementById("myform").submit();    
    }
bubuko.com,布布扣
bubuko.com,布布扣
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-top:none">
   <tr align="center" class="lantile">
       <th width="36%">指标名称</th>
    <th width="14%">指标代码</th>
    <th width="10%">计量单位</th>
   <th width="10%" colspan="2">操作</th>
 </tr>
  <c:forEach items="${ProList}" var="ral">
  <tr>
    <td align="left" style="text-align: left;"><span title="${ral.targetName}" style="cursor:hand">${ral.targetName}</span></td> 
    <td align="center"><c:if test="${ral.dispIndex<=9}">0${ral.dispIndex}</c:if><c:if test="${ral.dispIndex>9}">${ral.dispIndex}</c:if></td> 
    <td align="center">${ral.targetUnit}</div></td>
    <td stype="display:none;"><input type ="hidden" name="targetCode" id="targetCode" value = "${ral.targetCode}"/> </td>
    <td style="text-align: right;">
        <input type=‘button‘ class=‘moveup‘ onclick="move(this,‘1‘)" />
        <input type=‘button‘ class=‘movedown‘ onclick="move(this,‘2‘)" />
    </td>
   </tr>
  </c:forEach>
  
  </table>
bubuko.com,布布扣


通过dom操作  获取tr的childNodes[0].value 即可

 

table内 获取同一行 其他列的value,布布扣,bubuko.com

table内 获取同一行 其他列的value

原文:http://www.cnblogs.com/colmeluna/p/3746134.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!