JavaScript DHTML/Dojo toolkit/RadioButton

Материал из Web эксперт
Перейти к: навигация, поиск

Set RadioButton group and default selection

 
<html>
  <head>
    <link rel="StyleSheet" type="text/css"
      href="js/dojo/dijit/themes/tundra/tundra.css">
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/",
        parseOnLoad : true
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
      dojo.require("dojo.parser");
      dojo.require("dijit.form.RadioButton");
    </script>
  </head>
  <body class="tundra">
    <input dojoType="dijit.form.RadioButton" id="val1" name="group1" checked="checked" value="Programmer" type="radio" />
    <label for="val1"> Programmer </label>
    <input dojotype="dijit.form.RadioButton" id="val2"  name="group1" value="Designer" type="radio" />
    <label for="val2"> Designer </label>
    <input dojotype="dijit.form.RadioButton" id="val3"  name="group1" value="Developer" type="radio" />
    <label for="val3"> Developer </label> 
   </div>
  </body>
</html>



Setup radio button

 
<html>
  <head>
    <link rel="StyleSheet" type="text/css"
      href="js/dojo/dijit/themes/tundra/tundra.css">
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/",
        parseOnLoad : true
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
      dojo.require("dojo.parser");
      dojo.require("dijit.form.CheckBox");
    </script>
  </head>
  <body class="tundra">
        <input type="radio" id="rb1" dojoType="dijit.form.RadioButton" />&nbsp;
        <label for="rb1">Item 1</label>
        <input type="radio" id="rb2" dojoType="dijit.form.RadioButton" />&nbsp;
        <label for="rb2">Item 2</label>
        <input type="radio" id="rb3" dojoType="dijit.form.RadioButton" />&nbsp;
        <label for="rb3">Item 3</label>
        <input type="radio" id="rb4" dojoType="dijit.form.RadioButton" />&nbsp;
        <label for="rb4">Item 4</label>
       
  </body>
</html>