动态的从tr里拿id

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/includes.jsp"%>

<jsp:include page="../../common/header.jsp">
    <jsp:param name="title" value="房源回收站" />
    <jsp:param name="css" value="lp,house" />
    <jsp:param name="ajs"
        value="${publicResourceUrlPre}/public/js/WdatePicker.js" />
</jsp:include>


<div class="container">
    <jsp:include page="../../common/_pzglNav.jsp">
        <jsp:param name="curNav" value="fyhszList" />
    </jsp:include>

    <div class="mt_15">
        <table border="0" width="100%" cellpadding="0" cellspacing="0"
            class="tableListNew mt_10">
            <tr class="trHead">
                <td width="60" nowrap>序号</td>
                <td width="200" nowrap>房源</td>
                <td width="100" nowrap>房源编号</td>
                <td width="100" nowrap>状态</td>
                <td width="120">删除时间</td>
                <td width="180" nowrap>操作人</td>
                <td width="75" nowrap>操作</td>
            </tr>
            <c:forEach var="pro" items="${paginate.pageList}" varStatus="i">

                <tr id="pro_${pro.propertyId }">//拿到的id
                    <td nowrap>${i.index+1}</td>
                    <td nowrap>${pro.fullName}&nbsp;</td>
                    <td nowrap class="propertyId_${pro.propertyId}">${pro.propertyNo}</td>
                    <td nowrap><span>${pro.status}</span>&nbsp;</td>
                    <td><fmt:formatDate value="${pro.deletedAt}"
                            pattern="yyyy-MM-dd HH:mm:ss" /></td>
                    <td nowrap>${pro.username}</td>

                    <td nowrap><c:if test="${dy:hasAllOperORV2(SESSION_USER_V2,'PRP_Delete')}">
                            <input type="button" οnclick="recle('${pro.propertyId }',${pro.id})" value="还原">//事件的触发带参数id
                        </c:if> &nbsp;</td>

                </tr>
            </c:forEach>
        </table>
        <div class="pageCon">
            <app:paginate />
        </div>
    </div>
</div>
<jsp:include page="../../common/footer.jsp"></jsp:include>
<script type="text/javascript">
  function recle(propertyId,id){
     if(!confirm("确定要还原吗?")){
         return false;
     }
      alert(propertyId+"propertyId");
      alert(id);
     var url = '/propertyRecycle/'+ id;
     $.ajax({
         url:url,
         type:'delete',
         datatype:'json',
         success:function(){
             $("#pro_" + propertyId).hide();//动态的id隐藏
         }
     });
        
  }
</script>

要在HTML表格的一个`<tr>`(行)中动态添加另一个表格,你可以使用JavaScript动态创建新的表格元素,并将其添加到目标行中。以下是一个示例代码: ```html <!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> </head> <body> <table id="main-table"> <thead> <tr> <th>Name</th> <th>Age</th> </tr> </thead> <tbody> <tr id="target-row"> <td>John</td> <td>25</td> </tr> </tbody> </table> <button id="add-table-btn">Add Table</button> <script> $(document).ready(function() { // 添加新表格 $('#add-table-btn').click(function() { var newTable = $('<table>'); // 创建一个新的表格 // 创建新的表格行和单元格 var newRow1 = $('<tr>'); newRow1.append($('<td>').text('Cell 1')); newRow1.append($('<td>').text('Cell 2')); var newRow2 = $('<tr>'); newRow2.append($('<td>').text('Cell 3')); newRow2.append($('<td>').text('Cell 4')); // 将新的表格行添加到新表格中 newTable.append(newRow1); newTable.append(newRow2); // 将新表格添加到目标行中 $('#target-row').append($('<td>').append(newTable)); }); }); </script> </body> </html> ``` 在上述示例中,我们首先定义了一个包含目标行的表格。然后,我们在页面上添加了一个按钮,当点击该按钮时,会通过jQuery动态创建一个新的表格,并将其添加到目标行的一个单元格中。 通过点击 "Add Table" 按钮,你将看到新的表格被添加到目标行中。你可以根据需要修改代码以满足你的具体需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值