< h a r d c o d e r . c o m >
   intro |  html |  css |  design |  scripting |  dhtml |  server 

intro
html
css
design
scripting
dhtml
server



This page covers:
      Select Menu
      Radio Buttons
      Checkboxes

Select Menu

A SELECT menu, or a pulldown menu has 3 attributes - name, size, and multiple. The SELECT item needs the OPTION element to list the values.

Element

Attributes

SELECT

NOTE: Needs a closing tag </SELECT>
name: Name of the menu
size: (optional) Size of menu (in number of items)
multiple: (optional) Shows all available values

OPTION

NOTE: Closing tag, </OPTION> is optional
name: Name of the option
value: Value of option (if you want to pass a different value than the text next to the option.

Example:

Show 1 value:

Show all values:

CODE:

Show 1 value:
<SELECT NAME="Fav_Pet">
<OPTION>Cat
<OPTION>Dog
<OPTION>Rat
</SELECT>

Show all values:
<SELECT NAME="Fav_Color" MULTIPLE>
<OPTION>Green
<OPTION>Purple
<OPTION>Black
</SELECT>

Radio Buttons

RADIO buttons allow you to offer a variety of choices, but the user can only select one choice. When using the radio button, it's important to make sure the NAME attribute for each of the available choices in one category are all the same so that the user cannot select more than one value.

Element

Attributes

RADIO

name: Name of radio button. The NAME value must be the same for a set of choices in one category.
value: Value of the radio button
checked: (optional) Default checked value.

Example:

Where do you live?
Los Angeles
San Diego
San Francisco

Where do you work?
Home
Office
Don't Work


The small sqare the radio button is in will be the same color as the BGCOLOR attribute in the BODY element of the HTML page (in this case, white).

CODE:

Where do you live?
<INPUT TYPE="radio" NAME="city" VALUE="Los_Angeles" CHECKED>Los Angeles
<INPUT TYPE="radio" NAME="city" VALUE="San_Diego">San Diego
<INPUT TYPE="radio" NAME="city" VALUE="San_Francisco">San Francisco

Notice how "Los_Angeles" is marked as CHECKED in the example above.

Where do you work?
<INPUT TYPE="radio" NAME="work" VALUE="Home">Home
<INPUT TYPE="radio" NAME="work" VALUE="Office">Office
<INPUT TYPE="radio" NAME="work" VALUE="No_Work">Don't Work

Checkboxes

CHECKBOX allows the user to check multiple choices. The NAME attribute for each set of choices must be the same.

Element

Attributes

RADIO

name: Name of checkbox. All NAME values for one category must be the same.
value: Value of the checkbox
checked: (optional) Default checked value.

Example:

What sports are you interested in?
Football
Baseball
Basketball

CODE:

What sports are you interested in?
<INPUT TYPE="checkbox" NAME="sports" VALUE="Football" CHECKED>Football
<INPUT TYPE="checkbox" NAME="sports" VALUE="Baseball">Baseball
<INPUT TYPE="checkbox" NAME="sports" VALUE="Basketball">Basketball



 
This page last updated 03/09/07, 02:25 pm
hardCoder.com © 1999-2002. all rights reserved. // site created and maintained by kathy ahn