利用jquery做checkbox全选全不选的例子

Excel也能玩转K-means聚类?手把手教你用表格搞定用户分群(附完整公式) 本文详细介绍了如何在Excel中实现K-means聚类算法,无需编程即可完成用户分群。通过SUMIF、SQRT等基础函数,从数据预处理到最终分群全流程手把手教学,特别强调数据标准化和迭代优化的关键步骤,帮助运营团队低成本高效分析用户行为数据。 阅读详情

demo一:

 
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib uri="/WEB-INF/tlds/test.tld" prefix="pig"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+ path;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
      <script type="text/javascript" src="<%=path %>/scripts/jquery.js"></script>
	<script type="text/javascript">
		function checkSubmit() {
		
			document.Search.submit();
		}

	
		function fnull(){
			var obj = document.getElementById("goPage");
		  	var index = obj.selectedIndex; // 选中索引
		  	var text = obj.options[index].text; // 选中文本
		  	var go = obj.options[index].value; // 选中值

			//alert(go);
	        gopage(go);
	 	}
	 	
	    function gopage(page){
	    	var numberpg=document.getElementById("numberpg").value;
	    	document.getElementById("prepage").value=numberpg;
	    	document.getElementById("currPage").value=page;
	    	checkSubmit();
	    } 
	      
	    function px(){
	    	var numberpg=document.getElementById("numberpg").value;
	    	gopage(1);
	    }
	    function driction(id){
			document.s_result_form1.s_result_form1_id.value = id;	
			document.s_result_form1.submit();
		}
		
		$(function(){
	
			$("td").css("height","22px");
	
			$("#refresh").bind("click",function(){
				//location.reload();
				location="wlan!querySurveyWlan.do";
			});
			
			$(".dg_alternatingitemstyle").bind("mouseover",function(){
				$(this).children().css("height","22px");	
			});
			
			$(".dg_alternatingitemstyle").bind("mouseout",function(){
				$(this).children().css("height","22px");	
			});
		});
	</script>
<style type="text/css">
<!--
.f {
	font-size: 12px;
}
-->
</style>
</head>
<body id="master">
	
    <div id="mainareacontent">
        <div class="mainarea">
            <div class="dataarea">				     
				<table width="100%" cellpadding="0" cellspacing="0" class="title">
                        <tr>
                            <th width="1268">
                              <span>WLAN调查管理</span>                            
                            </th>
                            <td width="26" class="null">
	                            <input type="image" name="import" src="<%=path %>/themes/default/btn_sc.gif" onclick="deletes()" alt = "勾选批量删除"/>
                            </td>
                            <td width="16" class="null" align="center">
                            	<input type="image" name="export" src="<%=path %>/themes/default/btn_exp.gif" 
onclick="window.location = 'wlan!hotExport.do'" alt = "导出"/>
                            </td>
                            <td width="16" class="null">
                            	<img id="refresh" src="<%=path %>/themes/default/btn_sx.gif" width="50" height="20" alt = "刷新"/>
                            </td>
                        </tr>
              	</table>
		<!----------- 数据列表 ------------------>
				<div class="datagrid">  
					<div class="search" style="margin-top:0px;"> 
			                <form action="wlan!querySurveyWlan.do" method="post" onsubmit="return false;" 

name="Search" id="Search">
			                 <table cellpadding="0" cellspacing="0" width="97%">
			                    <tr>
			                    <td>记录日期:</td>
			                       <td><input type="text" name="msgDate" id="msgDate" value="${msgDate}"/></td>
			                    	<td>热点类型:</td>
			                       <td>
			                       	<s:select list="typeMap" name="msgType" value="msgType" theme="simple"/>
			                       	</td>			                      			                       
			                       <td>上网类型:</td>	
			                       <td>
			                       	<s:select list="areaMap" name="msgOnlineType" value="msgOnlineType" theme="simple"/>		                     
			                       </td>		                    
			                    </tr>
			                    <tr>
			                    	<td>手机号码:</td>
									<td>
										<input type="text" name="msgMobileno" id="msgMobileno" value="${msgMobileno}"/>
									</td>
			                    	<td>地址建议:</td>
			                       	<td>
			                       		<input type="text" name="msgAddress" id="msgAddress" value="${msgAddress}"/>
			                       	</td>  
			                       	<td style="text-align:left" colspan="2"><img style="width:50; height:20; 
border:0; cursor: pointer;" onclick="checkSubmit()" src="<%=path %>/themes/default/btn_search.gif" /></td>	         
			                    </tr>			                    
			                  </table>
			                  <input type="hidden" name="prepage" id="prepage" value="${prepage}"/>
                    		  <input type="hidden" name="currPage" id="currPage" value="${currPage}"/>
			                  </form>
			  		</div>
			  		   
				    <table id="list" width="100%" cellpadding="0" cellspacing="0" class="dg_borderstyle" border="1" bordercolor="#1C568A">
		              <tr>
		               <th width="3%" style="background-color:#9FBFE3"><div align="center" title="全选/全不选"><input id="allSelect" name="allSelect" type="checkbox" onclick="selectAll()" title="全选/全不选"/></div></th>		               
		               <th width="10%" style="background-color:#9FBFE3"><div align="center">记录日期</div></th>
		                <th width="10%" style="background-color:#9FBFE3"><div align="center">热点类型</div></th>
		               <th width="13%" style="background-color:#9FBFE3"><div align="center">上网类型</div></th>
		                <th width="12%" style="background-color:#9FBFE3"><div align="center">手机号码</div></th>
		                <th width="12%" style="background-color:#9FBFE3"><div align="center">地址建议</div></th>			                
		              </tr>
		              <s:iterator value="surveyList" id="dto" status="sta">
	                      <tr onMouseOver="MOver(this)" onMouseOut="Mout(this)" class="dg_alternatingitemstyle">	                       
	                        <td align="center" class="f">
	                        	<c:choose>
	                        		<c:when test="1==1">
	                        			<input id="ck" name="ck" type="checkbox" onclick="cancelCKSelect()" disabled="disabled"/>
	                        		</c:when>
	                        		<c:otherwise>
	                        			<input id="ck" name="ck" type="checkbox" onclick="cancelCKSelect()"/>
	                        		</c:otherwise>
	                        	</c:choose>	                        	
	                        	<input id="ckvalue${sta.count-1}" name="ckvalue${sta.count-1}" type="hidden" value="${dto.id}"/>
	                        </td>
	                         <td align="center" class="f">
	                        	${dto.recmakedate}
	                        </td>
	                        <td align="center" class="f">
	                        	${dto.type}
	                        </td>
	                        <td align="center" class="f">
	                        	${dto.onlinetype}
	                        </td>
	                        <td align="center" class="f">
	                        	${dto.mobileno}
	                        </td>
	                        <td align="center" class="f">
	                        	${dto.address}
	                        </td>                
	                      </tr>
                  	  </s:iterator>
		            </table>
		            <s:if test="surveyList.size>0">
		            <table width="98%" cellpadding="0" cellspacing="0" class="dg_pagestyle">
	                	<tr>
	                		<th>第${currPage}页 | 共${countPage}页/${countNum}条记录</th>
	                    	<td>每页  
		                        <select id="numberpg" name="numberpg" onChange="px(this.options

[this.selectedIndex].value)">
		                            <option <c:if test="${prepage==100}">selected="selected"</c:if> 

value="100">100</option>
		                            <option <c:if test="${prepage==300}">selected="selected"</c:if> 

value="300">300</option>
		                            <option <c:if test="${prepage==500}">selected="selected"</c:if> 

value="500">500</option>
		                        </select>
		                                                              条记录 | 第 
<select name="goPage" id="goPage">
	<s:iterator begin="1" end="countPage" status="stu">
		<c:choose>
			<c:when test="${stu.count==currPage}"><option value='${stu.count}' selected='selected'>${stu.count}</option></c:when>
			<c:otherwise>
				<option value="${stu.count}">${stu.count}</option>
			</c:otherwise>
		</c:choose>
	</s:iterator>
</select>
		                 <!-- <input type="text" style="width:25px;" id="goPage" value="${currPage}" onkeydown="if(event.keyCode==13){fnull();return false;}" style="IME-MODE: disabled; WIDTH: 60px; HEIGHT: 15px" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" />-->  页
					            <a onClick="fnull()" id="go" style="text-decoration:none;" >
					            <img border="0" src="<%=path %>/themes/default/btn_go.gif" />
					            </a>
					            <a  style="text-decoration:none;" onClick="gopage(1)">
					            <img border="0" src='<%=path %>/themes/default/btn_sy.gif'/>
					            </a>
					            <c:if test="${currPage!=1}">
					    		 <a  style="text-decoration:none;" onClick="gopage(${currPage-1})" >
					            <img border="0" src='<%=path %>/themes/default/btn_syy.gif'/>
					            </a>
					            </c:if>
					            <c:if test="${currPage!=countPage}">
					             <a style="text-decoration:none;" onClick="gopage(${currPage+1})">
					             <img border="0" src='<%=path %>/themes/default/btn_xyy.gif'/>
					             </a>
					            </c:if>
					            <a style="text-decoration:none;" onClick="gopage(${countPage})">
					            <img border="0" src='<%=path %>/themes/default/btn_wy.gif'/>
					            </a>	
		                    </td>			
		                </tr>
            		</table>
            		 </s:if>
		                <s:else>
		                	<center>当前查询没有数据!</center>
		                </s:else>
		             </div>
				</div>
        </div>
    </div>
</body>
</html>
<script>

$(function(){
	
});

function selectAll(){
	var ck = $("input[name=ck]");
	var currSelect = $("input[name=allSelect][checked]").val();
	
	$.each(ck,function(i){
		//alert(ck[i].disabled)
		if(!ck[i].disabled){
			ck[i].checked = currSelect;
		}
		
	});
}

function cancelCKSelect(){
	var ck = $("input[name=ck]");
	var r = true;
	$.each(ck,function(i){
		if(!ck[i].checked && !ck[i].disabled){
			r=false;
			return false;
		}
	});
	$('#allSelect').attr('checked', r); 
}

function deletes(){
	var delId ="";
	var ck = $("input[name=ck]");
	
	$.each(ck,function(i){
		if(ck[i].checked && !ck[i].disabled){
			delId += "'"+$("#ckvalue"+i).val()+"',";
		}	
	});
	delId = delId.substring(0,delId.lastIndexOf(","));
	if(delId != ""){
		var flag = window.confirm("您确定删除吗?");
		if(!flag){
			return;
		}
		window.location= "wlan!hotDelete.do?hotWlanId="+delId;
	}else{
		alert('请选择需要删除的数据!');
	}
}
</script>



  


demo二:

<script src="jquery-1.6.2.min.js"></script>


<input type="checkbox" id="ckAll" />check all<br />
<input type="checkbox" name="sub" />1<br />
<input type="checkbox" name="sub"/>2<br />
<input type="checkbox" name="sub"/>3<br />
<input type="checkbox" name="sub"/>4<br />


<script>

  $("#ckAll").click(function() {
    $("input[name='sub']").prop("checked", this.checked);
  });
  
  $("input[name='sub']").click(function() {
    var $subs = $("input[name='sub']");
    $("#ckAll").prop("checked" , $subs.length == $subs.filter(":checked").length ? true :false);
  });

</script>


 

从高德、百度地图下载POI数据?用这个工具5分钟搞定GCJ02/BD09到WGS84的坐标纠偏 本文详细解析了高德、百度地图POI数据坐标偏移问题,并提供了从GCJ02/BD09到WGS84的高效转换方案。通过开源工具如coordtransform和ArcGIS等专业软件,实现毫米级精度的坐标纠偏,适用于商业选址、GIS分析等场景,显著提升数据准确性和工作效率。 阅读详情

相关推荐

图片边界矢量化-地理配准

无地理和投影信息的JPG图片,通过ArcGIS进行地理配准(Georeferencing)完成数字化边界。

u012727861的博客 1905

使用jquery做复选框的全选,全不选

收到对方的所发生的

zhishiko的专栏 465

AI使用指南:6个超实用的Prompt提示词模板

最近越来越多人开始接触AI,但其实想要让AI更懂你,关键是掌握对的提示词模板!今天就给大家分享6种超实用的Prompt提示词模板,不管你是小白还是老手都能用

程序员世杰 8172

jquery全选、全不选、反选 效果

我在网上搜了很多的全选全不选效果,不过大多文章的思路大多很复杂,代码量也很多, 特意写了一个既能实现功能,代码和思路都很清晰的代码,这样小白也能看的懂 这个 是HTML5的新标签,当然你也可以这样写button按钮: html部分******************************************************** button id="btn

scenewood的博客 559

[信号与系统]一阶与二阶连续时间系统和离散时间系统

定义:一阶连续时间系统由一阶线性常系数微分方程描述: dy(t)dt+ay(t)=bx(t) \frac{dy(t)}{dt} + a y(t) = b x(t) dtdy(t)​+ay(t)=bx(t)时间常数:时间常数 τ=1a\tau = \frac{1}{a}τ=a1​ 是系统响应速度的衡量指标。时间常数越小,系统响应越快。冲激响应:一阶系统的冲激响应是指数衰减或增长的形式。例如,对于一个单位冲激输入,响应为: h(t)=bae−at h(t) = \frac{b}{a} e^{-at} h(t)=

Andius的博客 2121

拆解爆火AI图文日报!用扣子(Coze)工作流,10分钟实现自动化新闻早报

当用户提供一则新闻内容时,仔细分析新闻中的关键信息。提取新闻事件的核心要点,包括事件主体、发生时间、地点、主要情节等。用简洁的语言对新闻进行总结,控制在[X]字以内(可根据实际需求设定字数限制)。若用户提供多条新闻,对比各新闻之间的异同点。从事件类型、影响范围、发展趋势等方面进行分析。综合总结多条新闻的整体情况,以有条理的方式呈现给用户。

一身都是月 2426

jquery全选,jquery全不选,jquery反选

全选,不全选,反选 $(function () { $("#selectAll").click(function () {//全选 $("#playList :checkbox"

hexytxl的专栏 6万+

英飞凌 AURIX TC3XX 系列单片机的 NVM-Flash 介绍

简单介绍英飞凌 AURIX TC3XX 系列多核单片机的 Flash,便于快速上手使用

大橙子的博客 6637

jquery checkebox 全选 全不选 反选

/** * 点击按钮 * checkbox反选,全选,全不选 */ //全选 $("#id").click(function(){ $(":checkbox[name=xxx]").attr("checked",true); }); //全不选 $("#id").click(function(){ $(":checkedbox[name-xxx]").attr("checked",fal

Liaq325的专栏 1033

最新腾讯手游游戏appid列表及urlScheme一览 urlscheme查询

[全网独家] 2024最新腾讯游戏appid列表及urlScheme一览 手游包含王者荣耀QQ飞车我的世界PUBG吃鸡和平精英金铲铲之战三角洲行动QQ炫舞拳皇98OL欢乐斗地主 元梦之星使命召唤等

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 2万+

手把手教你学Simulink——整流器场景:基于PWM控制的单相全桥整流器设计

摘要:本文详细介绍了使用Simulink搭建基于PWM控制的单相全桥整流器的完整设计流程。主要内容包括:系统结构设计(含交流电源、全桥整流器、滤波电路等模块)、分步骤建模过程(从创建项目到添加各功能模块)、双闭环控制系统设计(电压外环和电流内环PI控制)、参数设置建议及仿真分析。通过仿真验证,该整流器可实现单位功率因数运行和稳定输出电压,并提供了数字锁相环等优化方向。文章为电力电子系统设计提供了实用的Simulink建模指导。(149字)

MHD0815的博客 324

用Jquery实现checkbox的反选、全选、全不选

当我们在用JS来实现web端操作的时候,多选框的全选、全不选和反选是最常用的功能,尤其是当数据量大的时候就需要这样的批量操作来给用户带来方便、快捷的服务了。        下面我们就来用JQuery实现checkbox多选框的全选、全不选、反选的功能:         假设有4个checkbox多选框,他们包含在一个id=“chk”的div中,而全选、全不选、反选的button按钮所在标签的i

阴慧超的博客 4万+

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

jquery表单ajax提交以及checkbox全选/全不选

<br />1.checkbox全选/全不选<br />//JQuery一句话搞定全选/全不选<br />$(document).ready(function() {<br />    $("#all").click(function() {<br />        $("input[name='serialNumbercheck']").attr("checked", $("input[id='all']").attr("checked"));<br />    });<br />})<br />//注

java20100406的专栏 3828

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

jquery实现checkbox全选全不选的简单实例

本篇文章主要是对jquery实现checkbox全选全不选的简单实例进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助 demo一:  代码如下:  String path = request.getContextPath();  String basePath = request.getScheme() + "://" + request.get

unity3d学习者 1090

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

jQuery 循环获取checkbox复选框的值,checkbox全选、全不选、反选

前端页面html <tr v-for="(log,index) in logList"> <!-- v-bind:value绑定 --> <td><input name="ids" :value="log.logId" type="checkbox"></td> </tr> js代码 - 循环获取checkbox复选框的值 //获取复选框checkbox选中的个数 /*var size = $("

Java小皮孩 3743

jquery checkbox全选与全不选

用jquery设置checkbox设置全选或者全不选,在网络上查找到大多数都是使用 $("checkbox").attr("checked",true);//设置全选 $("checkbox").removeAttr("checked");//设置全不选 但是我使用次方法之后第二次时候不能全选操作,后来查找应该这样 New document.nb

shikai2008的专栏 1060

JQuery操作全选与全不选,批量进行删除

引入jquery.js的插件 编写html 此处要注意,html中的id不能重复,所以在单选的input中用class 来做标记 编写JQ: //通过事件来改变选中值 $(function () { $(’#allCheck’).click(function () { $(’.check’).prop(‘checked’,this.checked); }) }) ...

小小的心,有大大的梦的博客 807

jquery实现全选/全不选功能

通常情况下,需要根据界面的复选框完成一个全选的功能,如何实现可以看注释,代码如下: <html> <head> <meta charset="utf-8"> <title>jquery实现全选/全不选</title> <!-- 引入jquery --> <script src="../js/jquery-3.5.1.js"></script&...

weixin_47382783的博客 1209

jQuery获取checkbox是否选中,设置值,checkbox全选全不选功能

html部分: <ul class="titleUl"> <li class="checkboxLi smLi"><input type="checkbox" class="checkboxOfLi selectAllLi"/></li> <li class="titleItemLi smLi">序号</li> <li class="titleItemLi lLi">寿命</li> <

nann-viiv 的博客 2868

jquery checkbox全选,全不选,反选方法,jquery checkbox全选只能操作一次

jquery checkbox全选,全不选,反选方法, jquery checkbox全选只有第一次成功 jquery checkbox全选只能操作一次,下载 Js代码   /**   * 全选   * 对于Jquey1.7.2+版本,使用attr会造成只能操作一次。   * 对于HTML元素本身就带有的固有属性,在处理时,使用prop方法。 

ningxiao1112的博客 394

checkBox 全选、全不选、反选

checkBox的使用: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"&gt...

151

jquery实现全选、反选、全不选

jquery实现全选、反选、全不选 jQuery实现的全选、全不选、反选 //使用jquery加载事件 $(document).ready(function (){ //设置全选 $("#all-yes").click(function (){ $("input[name=fav]").attr("checked","check

zhaoxinglei0309的专栏 1153

jquery 对 checkbox 的 全选、反选、全不选等操作

jQuery对checkbox的一些操作,比如选中,全选,反选,全不选等,通常我们会用到attr来改变checkbox的checked属性,然而通过实际测试,会出现各种小问题,例如第一次成功,第二次就不成功,调试也调不出来,说白了就是第二次的是attr方法未起到效果。经过查阅文档资料,最终确定使用prop 方法能彻底解决此问题,代码如下: function countCheckbox() {//

sunqian_happy的博客 509

利用jQuery实现CheckBox全选/全不选/反选

jQuery有些版本中实现CheckBox全选/全不选/反选会有bug,经测试jquery-1.3.1.js–>测试通过,jquery-1.5.1.js–>测试不通过。 实现CheckBox全选/全不选/反选代码如下: @ page language="java" pageEncoding="UTF-8"%>   DOCTYPE HTML PUBLIC "-//W3C//DTD H

u013257025的博客 364

jquery 全选 全不选 批量删除

jquery 实现全选反选批量删除 全选全不选按钮然后点击批量删除 < th >全选 < input type=“checkbox” id=“theadInp” />< /th > <input name=“ids” class=“ids” type=“checkbox” value="{{$v.id}}" / > $(function() { //实现全选反选 $("#theadInp").on('click', function

闫瑞祥的博客 646
上一篇: jQuery操作option
下一篇: 利用jsp生成excel格式文件
cg_program
博客等级 码龄19年 245粉丝 147原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值