This is a discussion on Learn WAP within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; The result MIGHT look like this in your mobile phone display: ------ Table ------ Cell 1 Cell 2 Cell 3...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| The result MIGHT look like this in your mobile phone display: ------ Table ------ Cell 1 Cell 2 Cell 3 |
| Sponsored Links |
| |||
| Links A WML card can be set up to display the anchor functions of WML. <anchor> The <anchor> tag always has a task ("go", "prev", or "refresh") specified. The task defines what to do when the user selects the link. In this example, when the user selects the "Next page" link, the task says "go to the file test.wml": <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Anchor Tag"> <p> <anchor>Next page <go href="test.wml"/> </anchor> </p> </card> </wml> |
| |||
| <a> The <a> tag always performs a "go" task, with no variables. The example below does the same as the <anchor> tag example: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="A Tag"> <p> <a href="test.wml">Next page</a> </p> </card> </wml> |
| |||
| Image A WML card can be set up to display an image: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Image"> <p> This is an image <img src="/images/stickman.wbmp" alt="stickman" /> in a paragraph </p> </card> </wml> |
| |||
| The result MIGHT look like this in your mobile phone display: ------ Image ------ This is an image in a paragraphNote that .wbmp is the only image type that can be displayed in a WAP browser. |
| |||
| Input Fields A WML card can be set up to let a user enter information, as demonstrated in this example: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Input"> <p> Name: <input name="Name" size="15"/><br/> Age: <input name="Age" size="15" format="*N"/><br/> Sex: <input name="Sex" size="15"/> </p> </card> </wml> |
| |||
| Select and Option A WML card, can be set up to display the select and option functions of WML: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Selectable List 1"> <p> <select> <option value="htm">HTML Tutorial</option> <option value="xml">XML Tutorial</option> <option value="wap">WAP Tutorial</option> </select> </p> </card> </wml> |
| |||
| The result MIGHT look like this in your mobile phone display: --- Selectable List 1--- HTML Tutorial XML Tutorial WAP Tutorial |
| |||
| In the example below, the result is a selectable list where the user can select more than one item: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Selectable List 2"> <p> <select multiple="true"> <option value="htm">HTML Tutorial</option> <option value="xml">XML Tutorial</option> <option value="wap">WAP Tutorial</option> </select> </p> </card> </wml> |
| |||
| The result MIGHT look like this in your mobile phone display: --- Selectable List 2--- HTML Tutorial XML Tutorial WAP Tutorial |
| |||
| Fieldset A WML card, can be set up to display the fieldset function of WML: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Fieldset"> <p> <fieldset title="CD Info"> Title: <input name="title" type="text"/><br/> Prize: <input name="prize" type="text"/> </fieldset> </p> </card> </wml> |
| |||
| The result MIGHT look like this in your mobile phone display: ------- Fieldset-------- CD Info Title: Prize: |
| |||
| A task specifies what action to perform when an event, like entering a card or selecting a link, occurs. Go Task The <go> task represents the action of switching to a new card. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card> <p> <anchor> Go To Test <go href="test.wml"/> </anchor> </p> </card> </wml> |
| |||
| Prev Task The <prev> task represents the action of going back to the previous card. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card> <p> <anchor> Previous Page <prev/> </anchor> </p> </card> </wml> |
| |||
| Refresh Task The <refresh> task refreshes some specified card variables. If any of the variables are shown on the screen, this task also refreshes the screen. The example below uses an <anchor> tag to add a "Refresh this page" link to the card. When the user clicks on the link, he or she refreshes the page and the value of the variable x will be set to 30: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card> <p> <anchor> Refresh this page <go href="thispage.wml"/> <refresh> <setvar name="x" value="30"/> </refresh> </anchor> </p> </card> </wml> |
| |||
| Noop Task The <noop> task says that nothing should be done (noop stands for "no operation"). This tag is used to override deck-level elements. The <do> tag can be used to activate a task when the user clicks on a word/phrase on the screen. The example below uses a <do> tag to add a "Back" link to the card. When the user clicks on the "Back" link, he or she should be taken back to the previous card. But the <noop> tag prevents this operation; when the user clicks on the "Back" link nothing will happen: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card> <p> <do name="back" type="prev" label="Back"> <noop/> </do> </p> </card> </wml> |
| |||
| Task Elements Start tag Purpose WML <go> Represents the action of switching to a new card 1.1 <noop> Says that nothing should be done (noop stands for "no operation"). Used to override deck-level elements 1.1 <prev> Represents the action of going back to the previous card 1.1 <refresh> Refreshes some specified card variables. If any of the variables are shown on the screen, this task also refreshes the screen 1.1 |
| |||
| Timer A WML card can be set up to use the timer function of WML. The time unit of the timer is 1/10 of a second. The example below will display a message for 3 seconds, and then take you to the file "test.wml": <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card ontimer="test.wml"> <timer value="30"/> <p>Some Message</p> </card> </wml> |
| |||
| Variables When a user switches from card to card in a deck, we need to store data in variables. WML variables are case sensitive. |