zoukankan      html  css  js  c++  java
  • js全选删除

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
          <script type="text/javascript">
              $(function(){
                  $("#selectAll").click(function(){
                    $("input[type=checkbox]:gt(0)").attr("checked","checked");             
                  });
                  $("#deleteAll").click(function(){
                      var array=new Array();
                      $("input[type=checkbox]:gt(0):checked").each(function(){
                          array.push($(this).parent().next().text());
                      });
                      console.log(array);
                      location.href="${pageContext.request.contextPath}/employee/batchDelete?ids="+array;
                  });
              });
          </script>
      </head>
     
      <body>
        <table>
            <tr>
                <th><input type="checkbox" id="selectAll"/></th>
                <th>用户ID</th>
                <th>用户姓名</th>
                <th>用户性别</th>
            </tr>
            <c:forEach items="${requestScope.list }" var="e">
                <tr>
                    <td><input type="checkbox"/></td>
                    <td>${e.id }</td>
                    <td>${e.name }</td>
                    <td>${e.gender }</td>
                </tr>
            </c:forEach>
        </table><br/>
        <input type="button" value="批量删除" id="deleteAll"/>
      </body>
    </html>

  • 相关阅读:
    python读取文件报错:pandas.errors.ParserError: iterator should return strings, not bytes (did you open the file in text mode?)
    Python关键字排序
    Python中赋值和print笔记
    python元祖和文件用法举例
    Python 列表和字典用法解释
    python中字符串及字符串的格式化
    python动态类型简介
    Python中关于深复制和浅复制详细解释
    Python中常用数字类型
    python内置对象的一些知识
  • 原文地址:https://www.cnblogs.com/Xuesk/p/7097167.html
Copyright © 2011-2022 走看看