Page 198 - DCAP512_WAP_AND_WML
P. 198
WAP & WML Sarabjit Kumar, Lovely Professional University
Notes Unit 14: Problems for Practice
1. Program to Accept Two numbers and print Sum
<?xml version=”1.0"?>
<!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN”
“http://www.wapforum.org/DTD/wml_1.1.xml”>
<wml>
<card id=”abc”>
<p>
Enter the first number:
<input type=”text” name=”nam”/><br>
Enter the second number:
<input type=”text” name=”nam1"/><br>
Result:<input type=”text” name=”message”/><br>
<do type=”Calculate”>
<go href=”two_num.wmls#root()”/>
</do>
</p>
</card>
</wml>
2. Program to Accept a numbers and calculate Square
<?xml version=”1.0"?>
<!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN”
“http://www.wapforum.org/DTD/wml_1.1.xml”>
<wml>
<card id=”abc”>
<p>
Enter the number:<input type=”text” name=”nam”/>
<do type=”square”>
<go href=”sq_root.wmls#root($(nam))”/>
</do>
$(message)
</p>
</card>
</wml>
3. Example of Simple WML Script
Coding of WML FIle
<?xml version=”1.0"?>
<!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN”
“http://www.wapforum.org/DTD/wml_1.1.xml”>
<wml>
<card id=”abc”>
192 LOVELY PROFESSIONAL UNIVERSITY