Checkboxes in XHTML MP

Preferences - Do not show ads

The following markup code creates a checkbox in XHTML MP:


<input type="checkbox" name="name_for_this_element"/>


Checkboxes of the same group should have the same name, like this:


<input type="checkbox" name="xhtml_mp_tutorial_chapter" value="1"/>
<input type="checkbox" name="xhtml_mp_tutorial_chapter" value="2"/>
<input type="checkbox" name="xhtml_mp_tutorial_chapter" value="3"/>


The value attribute defines the value to be sent to the server when the checkbox is checked. For example, if the first and second checkboxes in the above code are checked, the values "1" and "2" can be retrieved with the parameter name "xhtml_mp_tutorial_chapter" at the server-side.

Checkboxes are not checked by default. A checkbox will be checked initially if the checked attribute is specified, like this:


<input type="checkbox" name="xhtml_mp_tutorial_chapter" value="1" checked="checked"/>


The checked attribute only accepts "checked" as its value.


Radio Buttons in XHTML MP

The following markup code creates a radio button in XHTML MP:


<input type="radio" name="name_for_this_element"/>


Like checkboxes, radio buttons of the same group should have the same name. In a group of radio buttons, only one radio button can be in the checked state.


<input type="radio" name="xhtml_mp_tutorial_chapter" value="1"/>
<input type="radio" name="xhtml_mp_tutorial_chapter" value="2"/>
<input type="radio" name="xhtml_mp_tutorial_chapter" value="3"/>


The value attribute defines the value to be sent to the server. For example, if the second radio button in the above example is checked, the value "2" will be associated with the parameter name "xhtml_mp_tutorial_chapter". If the form is submitted, the name-value pair can be retrieved at the server.

Like checkboxes, radio buttons are not checked by default. A radio button will be checked initially if the checked attribute is specified, like this:


<input type="radio" name="xhtml_mp_tutorial_chapter" value="1" checked="checked"/>


The checked attribute only accepts "checked" as its value.


Page 31 of 36 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?






XHTML MP Tutorial Table of Contents XHTML MP Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page