删除(注意,删除后,后面顶上去,所以id会一直变,所以我们用class来定义,因为id是唯一的)

删除de

$(".delete").on("click",function(){
                var id = $(this).attr("value");
                var configTypeName = $(this).next().next("input").val();
                    ymPrompt.win({ 
                            330,
                            height:200,
                            icoCls: '',
                            message:'<div class="message">您确定要删除【'+configTypeName+'】配置吗?</div>',
                            titleBar:false,
                            winPos:'c',
                               btn:[['OK','ok'],['Cancel','no']],
                               handler:getButton1
                        });
                 
                         function getButton1(btn){
                             //拿到按钮的值
                                //删除行
                                if(btn == "ok"){
                                    var path = $("#path").val();
                                 window.location.href = path+"/deleteSystemconfig.action?id="+id;
                                }
                            }
                });
            

页面

 <a href="javascript:void(0)" class="delete" value="${s.id }" typeName="${s.configTypeName }">删除</a>
  这里用class来定义,因为拿到的id是一直会变化的,所以我们用var id = $(this).attr("value");来取得id的值(也可以在后面添加隐藏域来获得id)
 <div align="left" >
             <a href="javascript:void(0);"><img class="add" id="addBtn" src="${pageContext.request.contextPath }/imgs/u2.png"/></a>
         </div>
      <s:form  id="form">
        <table align="center" width="960" height="30" border="1px solid" id="systemconfig"/>
            <tr align="center" bgcolor="gray" cellpadding="0">
                <th>序号</th>
                <th>配置类型</th>
                <th>是否启用</th>
                <th>操作</th>
            </tr>
           <s:iterator value="systemconfigPageSupport.result" var="s" status="status">
           
            <tr align="center">
                <td><s:property value="#status.index+1"/></td>
                <td>${s.configTypeName }</td>
                <td>
                    <s:if test="#s.isStart == 1">启用</s:if>
                    <s:else>不启用</s:else>
                </td>
                <td>
                
                    <a href="javascript:void(0);" class="update" value="${s.id }" typeName="${s.configTypeName }" isStart="${s.isStart}">修改</a> | 
                    <!-- <a href="javascript:void(0);" onclick="deleteSystemconfig();">删除</a>| -->
                    <a href="javascript:void(0)" class="delete" value="${s.id }" typeName="${s.configTypeName }">删除</a>
                    <input type="hidden" id="path" value="${pageContext.request.contextPath }"/>
                </td>
            </tr>
        </s:iterator>
        </table>
原文地址:https://www.cnblogs.com/xuerong/p/5027735.html