<!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>check用户协议</title>
<script src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
<style type="text/css">
</style>
<script type="text/javascript">
$(function(){
//复选框点击事件
$("#chkAccept").click(function(){
setStatus(false);
});
$("#codGoPay").click(function(){
setStatus(true);
});
//注册按钮点击事件
function setStatus(isBtn){
var isAccept = $("#chkAccept").is(":checked");
if(isAccept){
$("#codGoPay").removeAttr("disabled");
}
else{
$("#codGoPay").attr("disabled","");
}
$("#spanErrMsg").toggle(!isAccept);
if(isAccept && isBtn){
reg();
}
}
function reg(){
alert("已接受协议,开始注册!");
//todo
}
});
</script>
</head>
<body>
<table style="width: 100%;">
<tr>
<td colspan="2" >
<input id="chkAccept" name="Accept" type="checkbox" />
<label for="chkAccept">我已阅读并接受<a href="https://www.baidu.com/">用户协议</a></label>
</td>
</tr>
<tr>
<td colspan="2" >
<input id="codGoPay" type="button" value="注册" disabled />
<span id="spanErrMsg" style="color:Red;">您还未接受用户协议</span>
</td>
</tr>
</table>
</body>
</html>