jquery 判断input 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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>李立纪念馆</title>
<link href="./css/index.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.STYLE17 {
	font-size: 12px;
	color: #666666;
}
</style>
</head>

<body>
	<div class="main">
		<div class="banner">
			<img src="image/banner.png" width="1024" height="200" />
		</div>
		<div class="nav">
			<a href="index.html">纪念主页</a> | <a href="introduction.html">艺术简介</a>
			| <a href="message.html">追思留言 </a> | <a href="#"> 相册  </a> | <a href="#"> 作品集 </a>
		</div>
		<div class="content">
			<div class="words_content"> 
				<div class="words_write">
					<div class="words_top">
						<form id="form1" name="form1" method="post" action="">
							<label> <input type="text" name="textfield" /> </label>
						</form>
					</div>
					<div class="words_down">
						<table width="433" height="35">
							<tr>
								<td width="238"><table width="242">
										<tr>
											<td width="46"> </td>
											<td width="184"><div align="right">
													<form id="form3" name="form3" method="post" action="">
														<label> <input type="checkbox" name="checkbox"
															value="checkbox" id="anonymous" /> </label>
													</form>
												</div>
											</td>
										</tr>
									</table>
								</td>
								<td width="42"><span class="STYLE17">匿名</span>
								</td>
								<td width="137"><form id="form2" name="form2" method="post"
										action="">
										<label> <input type="button" name="Submit" value="确定" id="confirm" />
										</label>
									</form></td>
							</tr>
						</table>
					</div>
				</div>
			</div>
			<div class="right_content">
				<table width="100">
					<tr>
						<td height="167"><a href="#"><img src="image/image1.png"
								width="212" height="149" border="0" />
						</a>
						</td>
					</tr>
					<tr>
						<td height="167"><a href="#"><img src="image/image2.png"
								border="0" />
						</a>
						</td>
					</tr>
					<tr>
						<td> <a href="#"><img src="image/image3.png"
								border="0" />
						</a>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="./js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="./js/layer/layer.min.js"></script>
	<script type="text/javascript">
		$(function(){
		   $("#confirm").bind("click",function(){
		   				//判断是否为匿名		   				
		   				 alert($("#anonymous").is(":checked"));
		           
		   });
		       
				
		});
	</script>

	

</body>
</html>
</span>


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值