jquery first-4 Dom方式获取数值方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>first-4</title>
<!-- 引入 jQuery -->
<script src="../js/jquery-1.3.1.js" type="text/javascript"></script>
<script type="text/javascript">
//等待dom元素加载完毕.
$(document).ready(function(){
var $cr = $("#cr"); //jQuery对象
var cr = $cr.get(0); //DOM对象,获取 $cr[0]
$cr.click(function(){
if(cr.checked){ //DOM方式判断
alert("感谢你的支持!");
}
})
});
</script>
</head>
<body>
<input type="checkbox" id="cr"/> <label for="cr">同意.</label>
</body>
</html>