JavaScript DHTML/GUI Components/RadioButton
RadioButton in a Group
<html>
<head>
<title>DynAPI Examples - RadioButton</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath("./dynapisrc/");
dynapi.library.include("dynapi.api");
dynapi.library.include("RadioButton");
</script>
<script language="Javascript">
rad0=new RadioButton("Red",100,100,100,16,null,true)
rad1=new RadioButton("Yellow",100,115,100,16)
rad2=new RadioButton("Blue",100,130,100,16)
rad3=new RadioButton("Female",0,0,100,16)
rad4=new RadioButton("Male",0,15,100,16)
mylayer=new DynLayer(null,200,200,100,50)
dynapi.document.addChild(rad0)
dynapi.document.addChild(rad1)
dynapi.document.addChild(rad2)
DynAPI.document.addChild(mylayer)
mylayer.addChild(rad3)
mylayer.addChild(rad4)
</script>
</head>
<body bgcolor="#ffffff">
<script>
dynapi.document.insertAllChildren();
</script>
</body>
</html>
<A href="http://www.wbex.ru/Code/JavaScriptDownload/dynapi.zip">dynapi.zip( 791 k)</a>
RadioButton in JavaScript
<html>
<head>
<title>DynAPI Examples - HTML RadioButton</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath("./dynapisrc/");
dynapi.library.include("dynapi.api");
dynapi.library.include("TemplateManager");
dynapi.library.include("HTMLRadioButton");
</script>
<script language="Javascript">
var tp = new Template(
"This is the Template (choose Car Color)<br>\n" +
"<center>\n" +
" <form>\n" +
" <table border="1" width="180">\n" +
" <tr>\n" +
" <td align="center">\n" +
" Select an option below<br>\n" +
" {@optblue}Blue {@optred}Red\n" +
" </td>\n" +
" </tr>\n" +
" </table>\n" +
" </form>\n" +
"</center>\n",
100,100,250,200,"#EEEEEE"
);
tp.addChild(new HTMLRadioButton(null,"color","Blue Car",true),"optblue");
tp.addChild(new HTMLRadioButton(null,"color","Red Car"),"optred");
tp.optblue.addEventListener({
onclick:function(e){
var o=e.getSource();
alert("This is a Radio Button with a value of ""+o.getValue()+"".");
}
});
tp.optred.addEventListener({
onclick:function(e){
var o=e.getSource();
alert("This is a Radio Button with a value of ""+o.getValue()+"".");
}
});
dynapi.document.addChild(tp);
</script>
</head>
<body>
<script>
dynapi.document.insertAllChildren();
</script>
</body>
</html>
<A href="http://www.wbex.ru/Code/JavaScriptDownload/dynapi.zip">dynapi.zip( 791 k)</a>