码迷,mamicode.com
首页 > 其他好文 > 详细

dojo-复选框

时间:2016-07-10 19:21:20      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

1、问题背景

     设计一组复选框,并获取复选框的值


2、实现源码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>dojo-复选框</title>
		<link rel="stylesheet" href="../js/dojo-release-1.11.1-src/dijit/themes/claro/claro.css" />
		<script type="text/javascript" src="../js/jquery-1.12.4.js"></script>
		<script type="text/javascript" src="../js/dojo-release-1.11.1-src/dojo/dojo.js"></script>
		<style>
			body,html{
				width: 99%;
				height: 99%;
				font-family: "微软雅黑";
				font-size: 12px;
				overflow: hidden;
			}
		</style>
		<script>  
            dojoConfig={async:true,parseOnLoad:true}  
        </script> 
		<script>
			require(["dijit/form/CheckBox", "dojo/domReady!"], function(CheckBox){
			    var checkBox = new CheckBox({
			        name: "checkBox",
			        value: "男",
			        checked: false,
			        onChange: function(b){ 
			        	alert(this.get(‘value‘) ); 
			        }
			    }, "man").startup();
			   
			   var checkBox1 = new CheckBox({
			        name: "checkBox",
			        value: "女",
			        checked: false,
			        onChange: function(b){ 
			        	alert(this.get(‘value‘) ); 
			        }
			    }, "woman").startup();
			});
		</script>
	</head>
	<body class="claro">
		<input id="man" /> 
		<label for="man">男</label>
		<input id="woman" /> 
		<label for="woman">女</label>
	</body>
</html>

3、实现结果

(1)当勾选“男”时

技术分享

(2)当勾选“女”时

技术分享

dojo-复选框

标签:

原文地址:http://blog.csdn.net/you23hai45/article/details/51854642

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!