Presentation is loading. Please wait.

Presentation is loading. Please wait.

WML & WML Script Presented by Kelvin Liu 01/06/2000.

Similar presentations


Presentation on theme: "WML & WML Script Presented by Kelvin Liu 01/06/2000."— Presentation transcript:

1 WML & WML Script Presented by Kelvin Liu 01/06/2000

2 Agenda Explain what is WML & WMLScripts. Explain the concept how WML “pages” are organized. How to create a WML “deck” from scratch. Integrate WML scripts functions into WML decks.

3 What Is WML ? Wireless Markup Language (WML) version 1.1 is designed for creating applications that run on small, mobile devices such as cellular phones and personal digital assistants.

4 WML Features WML looks somewhat like Hyper Text Markup Language (HTML). WML is a formally defined XML application. It inherits most of its syntactic constructs from extensible markup language (XML). WML has support for text and image.

5 WML Features User input support Text entry, options selections and task invocation Support Unicode Narrow-band optimization

6 Decks and Cards WML data is structured as a collection of “Cards”. A Single collection of cards is referred to as a WML “Decks”.

7 Decks and Cards Deck 1Deck 2 Card A Card B Card C Card D Card E Card F

8 Decks and Cards HTML Vs WML HTML WML html pages = wml decks html bookmarks = wml cards

9 WML Basics Syntax WML is case sensitive WML is markup language, uses tags - Starts of an element - Ends of an element - An empty element e.g. Line Break

10 WML Basics Syntax Document header must be present tag defines the deck. tag provide access control and metadata for the deck. tag defines different cards in a deck.

11 Example One Hello World!!!

12 Navigation in WML Creating a link in WML is just like creating a link in HTML Long Format Sample Link Short Format Sample Link

13 Example Two This card has two links to the second card. Short Form Link Long Form Link This is the second card.

14 Images WAP 1.1 standard specifies a new and only supported picture format, WBMP. It is a B/W image format without compression. Syntax

15 Events and Tasks Events are used to handle navigation and events by specifying the processing of user agent events Events: do – gives the user a general mechanism for performing actions on the current card. ontimer – The event occurs when a timer expires. onenterforward – The event occurs when the user enters a card using a go task or any method with identical semantics. onenterbackward – The event occurs when the user navigates into a card using a prev task or any method with identical semantics. onpick – The events occurs when the user select or deselects the item in which the event is specified. ETC………….

16 Events and Tasks Tasks defines the action to be performed when a certain event occurs. Tasks: go – It declares a go task, indicating navigation to an URL. prev – It declares a prev task, indicating navigation to the previous URL in the history stack. refresh – It declares a refresh task, indicating an update of the specified card variables. setvar – It specifies the variable to set in the current browser context as a side effect of executing a task. noop – It specifies that nothing should be done, that is, “no operation.” ETC…….

17 What is WMLScript? WMLScript was designed to provide general scripting capabilities to the WAP architecture. You can use WMLSctipt to complement WML, such as: Checking the validity of user input Accessing facilities of the user agent Generating messages and dialogs locally Allowing extensions to the user agent software and configuring a user agent after it has been deployed WMLScript has the same base as JavaScript, but some advanced features have been dropped.

18 WMLScript Syntax Syntax very similar to JavaScript. Case Sensitive Case != case Semicolons end most statement variable = value; Line or block comments//this OR /* this */ Basic operations+,-,*,/,=,==,!=,&&,< String operations“string text” + string_variable Blocks of statement {}while(somethings) {do this} Functions and parametersfunction function_name (p1,p2)

19 Calling functions from WML WML cards refer to WMLScript functions with URL calls Function must be specified as an externally callable function with extern Extern function func1(param1, param2) {…..}

20 WMLScript Libraries Standard libraries make WMLScript more efficient. Stored in client’s scripting environment. Libraries Lang(e.g. abs, min, max, etc.) Float(e.g. int, roung, sqrt, etc.) String (e.g. length, subString, find, etc.) URL(e.g. getHost, getPort, getPath, etc.) WMLBrowser (e.g. getVar, setVar, go, etc.) Dialogs(e.g. prompt,confirm, alert, etc.)

21 Example Three $num1 + $num2 = $result Calculate $num1 + $num2 = $result Calculate Again extern function add(x,y) { var res = Lang.parseInt(x)+Lang.parseInt(y); WMLBrowser.setVar("result",res); WMLBrowser.refresh(); WMLBrowser.go("example3.wml#c2"); } Example Provided by NOKIA


Download ppt "WML & WML Script Presented by Kelvin Liu 01/06/2000."

Similar presentations


Ads by Google