Page 158 - DCAP512_WAP_AND_WML
P. 158

WAP & WML




                    Notes          Self Assessment

                                   Fill in the blanks:
                                   6.  With  ………………………., the  wireless  device  can  do  some  of  the  processing  and
                                       computation.

                                   7.  WMLScript is a ………………………. language and is very similar to JavaScript.
                                   8.  WMLScript code is always placed in a file separate from the ……………………….
                                   9.  One common use of WMLScript is to ………………………. form data.

                                   11.3 Using WML Script Functions


                                   FunctionDeclaration:
                                          externopt function Identifier (FormalParameterListopt) Block ;opt
                                   FormalParameterList:
                                          Identifier

                                          FormalParameterList, Identifier
                                   You can use the optional extern keyword to specify that a function is to be externally accessible.
                                   External functions can be called from outside the compilation unit in which they are defined.

                                   Identifier is the name specified for the function.
                                   The optional FormalParameterList is a list of argument names separated by commas.
                                   Block is the body of the function that is executed when the function is called and the parameters
                                   have been initialized by the passed arguments.
                                   Function Example
                                          <wml>
                                                 <card> title=” Do Square”>

                                                        <p>
                                                               <do type =”accept” label =”SquareIt”>
                                                          <go href =”squareit.wml#doSquare(‘8’)” />
                                                               </do>

                                                               $test
                                                        </p>
                                                 </card>
                                                 <card title=”Results”>

                                                        <p>
                                                               The result is “$test”
                                                        </p>
                                                 </card>

                                          </wml>



          152                               LOVELY PROFESSIONAL UNIVERSITY
   153   154   155   156   157   158   159   160   161   162   163