Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

The Radio Widget

The Radio Button Widget

  • The Radio Button Widget is a lot like the Check Box widget in that it gives the user a way to select an item from a group. The main difference though is that radio buttons are used in radio groups that force the user to select one and only one item from a group.

  • Like check boxes the radio button can be set to either an "on" state or an "off" state by the user. Typically, the "on" state will look like a checked box or a filled in circle. A standard radio button group is shown below:

    Try it out...check one then check another.

    Behind the scenes, the above radio buttons were created with the following HTML code

        <FORM>
        <INPUT TYPE = "RADIO" NAME = "radio">
        <INPUT TYPE = "RADIO" NAME = "radio">
        <INPUT TYPE = "RADIO" NAME = "radio">
        </FORM>
    

  • Notice that the Radio Button widget is specified as an input TYPE of "RADIO" and that every radio button in a radio group shares the same NAME.

  • The Radio Button widget also has several other attributes that affect how it works. The following table outlines them:

Attribute Description
TYPE Specifies the type of interface widget. For a radio button widget, you use "RADIO"
NAME Specifies the variable name associated with this widget
VALUE Specifies the VALUE that will be sent in the URL-encoded string if the radio button is checked. If it is not checked, neither the name nor the value will be part of the URL-encoded string.
CHECKED Specifies that the radio button will be checked by default. It is recommended that you check one (but never more than one) option by default.

  • Let's take a closer look at each of these attributes.

The NAME and VALUE attributes

  • The NAME and VALUE attributes are essential and allow you to specify the name and value portion of the name/value pair that is sent as part of the URL-encoded string. For example, consider the following radio buttons:

    Apples
    Oranges
    Pears

    Here is the code that we used to make them.

        <FORM>
        <TABLE BORDER = "1">
        <TR>
        <TD>Apples</TD>
        <TD><INPUT TYPE  = "RADIO" 
    	       NAME  = "fruit" 
    	       VALUE = "apples"></TD>
        </TR>
    
        <TR>
        <TD>Oranges</TD>
        <TD><INPUT TYPE = "RADIO" 
    	       NAME = "fruit" 
                   VALUE= "oranges"></TD>
        </TR>
    
        <TR>
        <TD>Pears</TD>
        <TD><INPUT TYPE = "RADIO" 
    	       NAME = "fruit" 
                   VALUE= "pears"></TD>
        </TR>
        </TABLE>
        </FORM>
    

  • Notice that you can only check one radio button at one time.

  • Notice also that with radio buttons (unlike check boxes), the NAME value will be the same for all choices within a radio group. If you use a different name, you will be able to select more than one choice at a time and then the radio button is essentially a check box that you do not want.

  • Finally notice that the VALUE is used to specify which choice was selected. Thus, if the user selected Apples, the URL-encoded string would look like the following:

        fruit=apples
        

The CHECKED Attribute

  • The CHECKED attribute allows you to set the state of the radio button to "on" by default. You will want to set one radio button in a radio button group to CHECKED, but make sure that only one is checked. Take a look at the following example:

    Download JDK 1.1.4 for Java
    Download JDK 1.0.2 for Java
    Download the AFC for Java

    And here is the code that we used to make that radio group.

        <FORM>
        <TABLE BORDER = "1">
        <TR>
        <TD>Download JDK 1.1.4 for Java</TD>
        <TD><INPUT 	TYPE = "RADIO" 
    		NAME = "java_kit" 
                   	VALUE= "jdk_114"
    		>
        </TD>
        </TR>
    
        <TR>
        <TD>Download JDK 1.0.2 for Java</TD>
        <TD><INPUT 	TYPE = "RADIO"
    		NAME = "java_kit" 
                    VALUE= "jdk_102"
    		>
        </TD>
        </TR>
    
        <TR>
        <TD>Download the AFC for Java</TD>
        <TD><INPUT 	TYPE = "RADIO" 
    		NAME = "java_kit" 
                    VALUE= "afc" CHECKED>
        </TD>
        </TR>
        </TABLE>
        </FORM>
    

The Check Box Widget
Table of Contents
Non Input-based GUI Widgets


Up to => Home / Authoring / Scripting / Tutorial




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers