20.3. Checkboxes in XHTML MP
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.
20.4. 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.
Previous Page | Page 31 of 36 | Next Page |
- 1. XHTML MP (XHTML Mobile Profile) Introduction
- 2. Development of Wireless Markup Languages
- 3. Advantages of XHTML MP
- 4. WML Features Lost in XHTML MP
- 5. Syntax Rules of XHTML MP
- 6. XHTML MP MIME Types and File Extension
- 7. XHTML MP Document Structure
- 8. XHTML MP Generic Metadata
- 9. Comments in XHTML MP
- 10. Line Breaking in XHTML MP
- 11. XHTML MP Horizontal Rules
- 12. XHTML MP Headings
- 13. Font Style in XHTML MP
- 14. XHTML MP Preformatted Text
- 15. XHTML MP Lists
- 16. XHTML MP Images
- 17. XHTML MP Tables
- 18. Anchor Links in XHTML MP
- 19. XHTML MP Selection Lists
- 20. XHTML MP Input Elements
- 21. Submitting Form Data to the Server in XHTML MP