有关js判断checkbox,注册用
本帖最后由 wucj2008me 于 2013-01-29 15:22:40 编辑
注册时,有个用户协议的是否同意的判断的,为什么没checked没有提示?求大神~~
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>注册</title>
<script src="jQuery/jquery.min.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/clientreg.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function $(id) { return document.getElementById(id) }
function
cknull() {
if ($("reg_agree").attr("checked") != "true") {
$("
msg_agree").innerHTML = "提示:必须同意注册协议!";
return false;
}
/*document.regform.reg_agree.checked*/
}
</script>
</head>
<body>
<form method="post" id="formreg" runat="server">
<div>
<ul>
<li>
<h2><div class="regagree">
<p>重要须知:在此特别提醒用户认真阅读、充分理解本《软件许可及服务协议》(下称《协议》)
</h2></li>
<li>
<h2><input id="reg_agree" type="checkbox" name="reg_agree" />
<label for="reg_agree">我已阅读并同意注册协议</label>
</h2><h4 id="
msg_agree"></h4></li>
<li><h2>
<asp:Button ID="bt_reg" OnClientClick="
return cknull();" class="reg_btn_nor" runat="server" />
</h2></li>
</ul>
</div>
</form>
</body>
</html>
checkbox?reg
checkbox?
web
js
------解决方案-------------------- function $(id) { return document.getElementById(id) }
这个覆盖掉jquery定义了,jq选择器也不对
&