jquery图形多选复选框js代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 jquery图形多选复选框js代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

jquery图形多选复选框js代码

HTML代码(index.html):

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery图形多选复选框</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
	
$(document).ready(function() {
	
	/* see if anything is previously checked and reflect that in the view*/
	$(".checklist input:checked").parent().addClass("selected");
	
	/* handle the user selections */
	$(".checklist .checkbox-select").click(
		function(event) {
			event.preventDefault();
			$(this).parent().addClass("selected");
			$(this).parent().find(":checkbox").attr("checked","checked");
			
		}
	);
	
	$(".checklist .checkbox-deselect").click(
		function(event) {
			event.preventDefault();
			$(this).parent().removeClass("selected");
			$(this).parent().find(":checkbox").removeAttr("checked");
			
			
		}
	);
	
});
	
	</script>
	
	
<style type="text/css">

body {
	font: 12px/1.3 "Lucida Grande","Lucida","Arial",Sans-serif;
}

form {
	margin: 0 0 30px 0;
}

legend {
	font-size: 17px;
}

fieldset {
	border: 0;
}

.checklist {
	list-style: none;
	margin: 0;
	padding: 0;
}

.checklist li {
	float: left;
	margin-right: 10px;
	background: url(i/checkboxbg.gif) no-repeat 0 0;
	width: 105px;
	height: 150px;
	position: relative;
	font: normal 11px/1.3 "Lucida Grande","Lucida","Arial",Sans-serif;
}

.checklist li.selected {
	background-position: -105px 0;
}

.checklist li.selected .checkbox-select {
	display: none;
}

.checkbox-select {
	display: block;
	float: left;
	position: absolute;
	top: 118px;
	left: 10px;
	width: 85px;
	height: 23px;
	background: url(i/select.gif) no-repeat 0 0;
	text-indent: -9999px;
}

.checklist li input {
	display: none;	
}

a.checkbox-deselect {
	display: none;
	color: white;
	font-weight: bold;
	text-decoration: none;
	position: absolute;
	top: 120px;
	right: 10px;
}

.checklist li.selected a.checkbox-deselect {
	display: block;
}

.checklist li label {
	display: block;
	text-align: center;
	padding: 8px;
}

.sendit {
	display: block;
	float: left;
	top: 118px;
	left: 10px;
	width: 115px;
	height: 34px;
	border: 0;
	cursor: pointer;
	background: url(i/sendit.gif) no-repeat 0 0;
	text-indent: -9999px;
	margin: 20px 0;
}

</style>
	
	
	
</head>

<body>


	<form action="">
		<fieldset>
			<legend>Choose some stuff...</legend>
				<input name="jqdemo" value="value1" type="checkbox" id="choice1"/> <label for="choice1">Choice one</label>
				<input name="jqdemo" value="value2" type="checkbox" id="choice2"/> <label for="choice2">Choice two</label>
				<input name="jqdemo" value="value3" type="checkbox" id="choice3" checked="checked"/> <label for="choice3">Choice three</label>
				<input name="jqdemo" value="value4" type="checkbox" id="choice4"/> <label for="choice4">Choice four</label>
			<br/><br/>
			<button type="submit" name="submitbutton" title="Submit the form">Send it!</button>
		</fieldset>
	</form>


	<form action="">
		<fieldset>
			<legend>Choose some stuff...</legend>
			<ul class="checklist">
				<li>
					<input name="jqdemo" value="value1" type="checkbox" id="choice_a"/>
					<label for="choice_a">Here's the 1st selection</label>
					<a class="checkbox-select" href="#">Select</a>
					<a class="checkbox-deselect" href="#">Cancel</a>
				</li>
				<li>
					<input name="jqdemo" value="value2" type="checkbox" id="choice_b"/>
					<label for="choice_b">Here's the 2nd selection</label>
					<a class="checkbox-select" href="#">Select</a>
					<a class="checkbox-deselect" href="#">Cancel</a>
				</li>
				<li>
					<input name="jqdemo" value="value3" type="checkbox" id="choice_c" checked="checked"/>
					<label for="choice_c">Here's the 3rd selection</label>
					<a class="checkbox-select" href="#">Select</a>
					<a class="checkbox-deselect" href="#">Cancel</a>
				</li>
				<li>
					<input name="jqdemo" value="value4" type="checkbox" id="choice_d"/>
					<label for="choice_d">Here's the 4th selection</label>
					<a class="checkbox-select" href="#">Select</a>
					<a class="checkbox-deselect" href="#">Cancel</a>
				</li>
			</ul>
			<div style="clear: both;"></div>
			<button class="sendit" type="submit" name="submitbutton" title="Submit the form">Send it!</button>
		</fieldset>
	</form>
</body>
</html>









附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
26.49 KB
jquery特效2
最新结算
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
HTML5实现CSS滤镜图片切换特效代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery+css3实现信封效果
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章