Scripting a Group of Radio Objects : RadioButton Radio : Form Control : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP
JavaScript DHTML Home »  Form Control   » [  RadioButton Radio  ]   
 



Scripting a Group of Radio Objects

Please note that some example is only working under IE or Firefox.


/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

Publisher: John Wiley & Sons CopyRight 2001
ISBN: 0764533428

*/



<HTML>
<HEAD>
<TITLE>Extracting Highlighted Radio Button</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function fullName() {
    var form = document.forms[0]
    for (var i = 0; i < form.stooges.length; i++) {
        if (form.stooges[i].checked) {
            break
        }
    }
    alert("You chose " form.stooges[i].value + ".")
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<B>Select your favorite Stooge:</B>
<INPUT TYPE="radio" NAME="stooges" VALUE="Moe Howard" CHECKED>Moe
<INPUT TYPE="radio" NAME="stooges" VALUE="Larry Fine" >Larry
<INPUT TYPE="radio" NAME="stooges" VALUE="Curly Howard" >Curly<BR>
<INPUT TYPE="button" NAME="Viewer" VALUE="View Full Name..." 
onClick="fullName()">
</FORM>
</BODY>
</HTML>


           
       
Related examples in the same category
1.  'defaultChecked' Example
2.  Radio Button status Example
3.  Check a Radio Button
4.  Radio buttons in a form
5.  Using the onPropertyChange Property
6.  Radio action
7.  Methods and Properties of the Radio Object
8.  Determining the Value of the Selected Radio Button
9.  Finding the Selected Button in a Radio Group
10.  An onClick event Handler for Radio Buttons
11.  Get the radio button selection
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.