• dojo-复选框


    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{
    				 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)当勾选“女”时


  • 相关阅读:
    事以密成,能者低调
    时间过得真快,一晃三年过去了
    读书随记2011111
    Makefile
    ubuntu 7 下 tftp 的配置
    uboot移植到nano2410
    ubuntu 7.04 Feisty Fawn 安装手记之五:安装常用软件
    移植linux2.6.18到arm9
    移植busybox 1.4.2
    UBoot中SMDK2410的NAND Flash驱动。
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13314117.html
Copyright © 2020-2023  润新知