jquery 判断input checkbox 是否选中
你猜
阅读:656
2021-03-31 22:40:30
评论:0
判断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>
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。