You are previewing Learning WML, and WMLScript.
O'Reilly logo
Learning WML, and WMLScript

Book Description

The next generation of mobile communicators is here, and delivering content to them will mean programming in WML (Wireless Markup Language) and WMLScript, the languages of the Wireless Application Environment (WAE). The WAE allows information in almost all applications to be formatted for display on mobile devices, such as cell phones, and enables the user to interact with the information. Why learn yet another technology? According to some estimates, 75 percent of web document viewing by the year 2002 will be through non-desktop devices, many using wireless technologies. Clearly, the future is wireless. For web developers who want to get up to speed quickly in these languages, Learning WML & WMLScript maps out in detail the WAE and its two major components, WML and WMLScript. Fortunately, the WAE provides a World Wide Web-like model for writing applications, incorporating several key features of the Web to ease the transition for developers. Almost all wireless applications can be written with WML, which replaces HTML in the wireless environment, and WMLScript, which replaces JavaScript. With this book, web developers with some knowledge of programming and C, Java, or JavaScript syntax can easily master both languages. Chapter by chapter, Learning WML & WMLScript takes readers through the following WML topics:

  • Decks, templates and cards

  • User Interaction

  • Variables and contexts

  • Tasks, events, and timers

  • Text and text formatting

  • Data types, conversions and variables

  • Operators and expressions

  • Statements

  • Functions

  • Standard libraries

WMLScript topics include:

Learning WML & WMLScript is the resource of choice for application developers who want to upgrade their skills and their sites so they won't be left plugged in during the wireless revolution.

Table of Contents

  1. Learning WML & WMLScript
    1. Preface
      1. The WAP Stack
      2. From Server to Client
        1. The WAP Gateway
      3. This Book
      4. Conventions Used in This Book
      5. Comments and Questions
      6. Acknowledgments
    2. 1. Introduction to WML
      1. A Complete Example
      2. Cards
      3. Empty-Element Tags
      4. Elements
      5. Attributes
        1. Notation for Attributes
      6. Entities
      7. Comments
    3. 2. WML Variables and Contexts
      1. Variable Substitution
        1. Empty Variables
        2. Caveats of Variable Substitution
      2. Setting Variables
        1. The <setvar> Element
          1. Attributes of the <setvar> element
        2. Order of Operations in Setting Variables
      3. Browser Contexts
    4. 3. WML Tasks and Events
      1. Tasks
        1. Tasks and Variables
        2. The <go> Task
          1. Attributes of the <go> task
          2. The method attribute: GET and POST
          3. The <postfield> element
          4. Shorthand forms of <go> tasks
        3. The <prev> Task
        4. The <refresh> Task
        5. The <noop> Task
      2. Events
        1. The <onevent> Element
        2. Card Events
          1. The onenterforward event
          2. The onenterbackward event
    5. 4. WML User Interaction
      1. Problems with Web Interaction
      2. Interaction in WAP
      3. The <input> Element
        1. Attributes of the <input> Element
        2. Examples of the <input> Element
      4. The <select> Element
        1. Attributes of the <select> Element
        2. Multiple Selection
      5. The <option> Element
        1. Attributes of the <option> Element
      6. The <optgroup> Element
      7. The <do> Element
        1. Attributes of the <do> Element
      8. The <anchor> Element
      9. The <a> Element
      10. The tabindex Attribute
    6. 5. WML Timers
      1. Using Timers with WML
        1. A Simple Example
        2. The ontimer Event
      2. The <timer> Element
        1. A Complicated Example
    7. 6. WML Decks, Templates, and Cards
      1. The <wml> Element
      2. The <head> Element
      3. The <access> Element
        1. Attributes of the <access> Element
      4. The <meta> Element
        1. Attributes of the <meta> Element
      5. The <card> Element
        1. Attributes of the <card> Element
      6. The <template> Element
        1. Shadowing
        2. Attributes of the <template> Element
        3. Examples of the <template> Element
    8. 7. WML Text and Text Formatting
      1. The <p> Element
        1. Attributes of the <p> Element
      2. The <br> Element
      3. Character Formatting
        1. Emphasis
        2. Size Changes
        3. Style Changes
        4. Examples
      4. Tables
        1. The <table> Element
          1. Attributes of the <table> element
        2. The <tr> Element
        3. The <td> Element
        4. Example
    9. 8. WML Images
      1. The <img> Element
        1. Attributes of the <img> Element
        2. Examples
      2. The WBMP Image Format
    10. 9. Introduction to WMLScript
      1. WMLScript with WML
        1. WMLScript to the Rescue
      2. What Is WMLScript?
        1. Standard Libraries
        2. Bytecode
        3. Functions
    11. 10. WMLScript Datatypes, Variables, and Conversions
      1. Datatypes and Literals
        1. Strings
        2. Integers
        3. Floating-Point Numbers
        4. Booleans
        5. Invalid
      2. Variables
        1. Variable Scope
        2. Variable Names
        3. Namespaces
      3. Type Conversion
        1. Conversion to String
        2. Conversion to Integer
        3. Conversion to Floating-Point Number
        4. Conversion to Boolean
    12. 11. WMLScript Operators and Expressions
      1. Operand Conversions
        1. Unary Integer or Floating Point
        2. Binary Integer or Floating Point
        3. Integer, Floating Point, or String
        4. Comparison Operators
      2. Assignment Operators
      3. Arithmetic Operators
      4. Bitwise Operators
      5. Shift Operators
      6. Logical Operators
      7. Increment and Decrement Operators
      8. Comparison Operators
      9. Type Operators
      10. The Conditional Operator
      11. The Comma Operator
      12. Precedence and Associativity
    13. 12. WMLScript Statements
      1. Expressions as Statements
      2. Blocks of Statements
      3. Conditions
      4. Loops
        1. The break Statement
        2. The continue Statement
      5. Returning from a Function
      6. Other Statements
    14. 13. WMLScript Functions
      1. Function Declarations
      2. Function Calls
      3. Calls to Other Script Units
        1. The url pragma
      4. Calling WMLScript from WML
        1. Embedding the Function Call in a <go> Task
          1. Variable substitution
          2. No expressions as arguments in shorthand forms of the <go> task
          3. Additional minor differences
        2. Examples of Calling WMLScript from WML
      5. Standard Libraries
        1. Calling the Standard Libraries
    15. 14. WMLScript Pragmas
      1. The access Pragma
      2. The meta Pragma
    16. 15. The Lang Library
      1. abort
      2. abs
      3. characterSet
      4. exit
      5. float
      6. isFloat
      7. isInt
      8. max
      9. maxInt
      10. min
      11. minInt
      12. parseFloat
      13. parseInt
      14. random
      15. seed
    17. 16. The Float Library
      1. ceil
      2. floor
      3. int
      4. maxFloat
      5. minFloat
      6. pow
      7. round
      8. sqrt
    18. 17. The String Library
      1. charAt
      2. compare
      3. elementAt
      4. elements
      5. find
      6. format
      7. insertAt
      8. isEmpty
      9. length
      10. removeAt
      11. replace
      12. replaceAt
      13. squeeze
      14. subString
      15. toString
      16. trim
    19. 18. The URL Library
      1. escapeString
      2. getBase
      3. getFragment
      4. getHost
      5. getParameters
      6. getPath
      7. getPort
      8. getQuery
      9. getReferer
      10. getScheme
      11. isValid
      12. loadString
      13. resolve
      14. unescapeString
    20. 19. The WMLBrowser Library
      1. getCurrentCard
      2. getVar
      3. go
      4. newContext
      5. prev
      6. refresh
      7. setVar
    21. 20. The Dialogs Library
      1. alert
      2. confirm
      3. prompt
    22. 21. Complete Examples
      1. Calculator
        1. WMLScript for the Calculator
        2. Finishing Off
        3. Exercises
      2. Battleships
        1. WMLScript for Battleships
        2. Exercises
    23. A. Absolute and Relative URLs
      1. Parts of a URL
        1. Examples
      2. Resolving Relative URLs
        1. Examples
    24. B. WAP Gateways and WSP
      1. WSP Headers
      2. Browser Support for Caching
    25. C. Summary of WMLScript Operators
    26. D. Serving WAP Content from a Standard Web Server
    27. Index
    28. Colophon