WML What is WML? WML stands for Wireless Markup Language. It is a mark-up language inherited from HTML, but WML is based on XML, so it is much stricter.

Slides:



Advertisements
Similar presentations
Chapter 7 JavaScript: Introduction to Scripting. Outline Simple Programs Objects and Variables Obtaining User Input with prompt Dialogs – –Dynamic Welcome.
Advertisements

Java Script Session1 INTRODUCTION.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
1 Programmer-Defined Functions Functions allow program modularization Variables declared in function are local variables Only known inside function in.
The Web Warrior Guide to Web Design Technologies
1 Dickson K.W. Chiu PhD, SMIEEE Thanks to Prof. S.C. Cheung (HKUST) CSIT600b: XML Programming WML.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
Copyright © Gavin McArdell WML Training Course Gavin McArdell.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
HTML Comprehensive Concepts and Techniques Second Edition Project 8 Integrating JavaScript with HTML.
Introduction to scripting
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
4.1 JavaScript Introduction
JavaScript: Control Structures September 27, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel,
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
WML, WMLS More acronyms than you can shake a stick at!
Scripting Languages.
WML II (“Son of WML”) WML WMLScript. WML - A Quick Review Document structure ,... Text and image controls ...,,..., Navigation controls ,,, Events.
ULI101 – XHTML Basics (Part II) What is Markup Language? XHTML vs. HTML General XHTML Rules Block Level XHTML Tags XHTML Validation.
By Amisha Pardasani. Contents Introduction to Wireless Application Protocol Introduction to Wireless Markup Language WML Formatting Links and Images Input.
Lectured By: Vivek Dimri Assistant Professor, CSE Dept. SET, Sharda University, Gr. Noida.
WAP and WML The Wireless Application Protocol  WAP architecture  WML document structure  WML syntax Basic document syntax Layout Text formatting Images.
WML Wireless Markup Language Presented by: Richa Saxena Roll no
CIS 375—Web App Dev II WAP. 2 Introduction to WAP WAP ________________________ is an application communication protocol that uses a ______ Browser in.
WML Programming. What is WML WML Programming Wireless mark up language based on XML. Purpose:  to specify user interface behavior and  display contents.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
JavaScript: Functions © by Pearson Education, Inc. All Rights Reserved.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Ericsson Competence Solutions Rev A16/11/011 Mobile Learning Course for R380 and R520 Presented by Michelle Almeida Course Structure Design Guidelines.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Keeping it Neat: Functions and JavaScript Source Files Chapter 7.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 23 - Wireless Internet and m- Business Outline 23.1 Introduction 23.2 M-Business 23.3 Identifying.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
Presented By: Dixit Wadhwani B.TECH 3 rd YEAR, CSE 07CS Sir Padampat Singnania University Technical Seminar on Wireless Markup Language Guided By:
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
1 Server versus Client-Side Programming Server-SideClient-Side.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
WML & WML Script Presented by Kelvin Liu 01/06/2000.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Java Script About Java Script Document Object Model Incorporating JavaScript Adding JavaScript to HTML Embedding a Javascript External Scripts Javascript.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
CSC 121 Computers and Scientific Thinking Fall Event-Driven Programming.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
INTERNET APPLICATIONS CPIT405 JavaScript Instructor: Rasha AlOmari
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
REEM ALMOTIRI Information Technology Department Majmaah University.
Tutorial 10 Programming with JavaScript
Project 9 Creating Pop-up Windows, Adding Scrolling Messages, and Validating Forms.
14 A Brief Look at JavaScript and jQuery.
JavaScript an introduction.
M-Commerce Wireless Markup Language (WML) By Prof T.R. Vaidyanathan.
Chapter 23 - Wireless Internet and m-Business
Tutorial 10: Programming with javascript
JavaScript: Introduction to Scripting
Presentation transcript:

WML What is WML? WML stands for Wireless Markup Language. It is a mark-up language inherited from HTML, but WML is based on XML, so it is much stricter than HTML. WML is used to create pages that can be displayed in a WAP browser. Pages in WML are called DECKS. Decks are constructed as a set of CARDS. What is WMLScript? WML uses WMLScript to run simple code on the client. WMLScript is a light JavaScript language. However, WML scripts are not embedded in the WML pages. WML pages only contains references to script URLs. WML scripts need to be compiled into byte code on a server before they can run in a WAP browser.

Prolog Every WML document starts with the prolog. The first line is the XML declaration and the second line is the DOCTYPE declaration. The prolog components are not WML elements and they should not be closed, i.e. you should not give them an end tag or finish them with />.

example hello.wml anchor tag line break Table previous taskprevious task select list font style Timer save variable

The tag The tag always has a task ("go", "prev", or "refresh") specified. The task defines what to do when the user selects the link.

The tag The tag always performs a "go" task, with no variables.

tag A WML card can be set up to display an image with this tag..wbmp is the only image type that can be displayed in a WAP browser

Example multiple selection input tag Image field set Template Onenterbackward onenterforward dotag

WMLScript Dialogs Library Functions FunctionDescription alert()alert() Displays a message and waits for a confirmation confirm()confirm() Displays a message and waits for an answer prompt()prompt() Displays a question and waits for an input

WMLScript Float Library Functions The Float library works only on clients that support floating-point numbers. If floating-point numbers are not supported, all functions should return invalid. FunctionDescription ceil(x) Returns the nearest integer that is not smaller than a specified numberceil(x) floor(x) Returns the nearest integer that is not larger than a specified numberfloor(x) int(x) Returns the integer part of a specified numberint(x) maxFloat()Returns the largest possible floating-point numbermaxFloat() minFloat()Returns the smallest possible floating-point numberminFloat() pow(x,y)Returns the value of x raised to the power of ypow(x,y) round(x)Rounds a number to the nearest integersqrt(x)Returns the square root of a numberround(x)sqrt(x)

WMLScript Lang Library Functions FunctionDescription abort() Aborts a WMLScript and returns a message to the caller of the scriptabort() abs(x) Returns the absolute value of a numberabs(x) characterSet() Returns the character-set supported by the WMLScript interpretercharacterSet() exit()Exits a WMLScript and returns a message to the caller of the scriptexit() float()Returns a Boolean value that indicates whether floating-point numbers are supportedfloat() isFloat()Returns a Boolean value that indicates whether a value can be converted into a floating-point number by the parseFloat() functionisFloat() isInt()Returns a Boolean value that indicates whether a value can be converted into an integer by the parseInt() functionisInt() max(x,y)Returns the number with the highest value of x and ymax(x,y) maxInt()Returns the maximum possible integer valuemaxInt() min(x,y)Returns the number with the lowest value of x and ymin(x,y) minInt()Returns the minimum possible integer valueminInt() parseFloat()Returns a floating-point value defined by a stringparseFloat() parseInt()Returns an integer defined by a stringparseInt() random(x)Returns a random integer between 0 and xrandom(x) seed()Initializes the random number generator with a number, and returns an empty stringseed()

WMLScript String Library Functions FunctionDescription charAt()Returns the character at a specified positioncharAt() compare()Compares two strings and returns a value that represents the result of the comparisoncompare() elementAt()Divides a string into elements and returns a specified elementelementAt() elements()Returns the number of times a specified value appears in a stringelements() find()Returns the position of a substring in a stringfind() format()Formats a valueformat() insertAt()Divides a string into elements and inserts a substring at a specified index positioninsertAt() isEmpty()Checks whether a string is emptyisEmpty() length()Returns the length of a stringlength() removeAt()Divides a string into elements and removes a specified elementremoveAt() replace()Replaces a part of a string with a new stringreplace() replaceAt()Divides a string into elements and replaces a specified elementreplaceAt() squeeze()Reduces all multiple spaces to single spaces in a stringsqueeze() subString()Returns a specified part of a stringsubString() toString()Converts a value to a stringtoString() trim()Returns a string without leading and trailing spacestrim()

WMLScript WMLBrowser Library Functions FunctionDescription getCurrentCard()Returns the (relative) URL of the current cardgetCurrentCard() getVar()Returns the value of a variablegetVar() go()Goes to a new cardgo() newContext()Clears all variablesnewContext() prev()Goes to the previous cardprev() refresh()Refreshes the current cardrefresh() setvar()Sets the value of a variablesetvar()

String library var char = String.charAt("WMLScript Tutorial", 0); After executing the above line of script, char contains the string value W.

Float library w = Float.round(10.4); x = Float.round(10.5); y = Float.round(-10.5); z = Float.round(10); After the execution of the above script, w has the integral value 10, x has the integral value 11, y has the integral value -10 and z has the integral value 10. w = Float.int(10.4); x = Float.int(10.5); y = Float.int(-10.5); z = Float.int(10); After the execution of the above script, w and x contain the integral value 10, y contains the integral value -10 and z contains the integral value 10.

Lang library Lang.seed(-1); var random_num1 = Lang.random(10); var random_num2 = Lang.random(99); After executing the above code, random_num1 contains an integer in the range 0 to 10 and random_num2 contains an integer in the range 0 to 99.

how to call WMLScript code in a WML document. Run WMLScript $(message)

WMLScript code extern function helloWorld() { WMLBrowser.setVar("message", "Hello World. Welcome to our WMLScript tutorial."); WMLBrowser.refresh(); }

Open the helloWorldEg1.wml file in a mobile phone browser and you can see something like this: Nokia mobile browser 4.0

Inside the helloWorld() function, we use two functions of the WMLBrowser standard library, setVar() and refresh(). The setVar() function is used to assign a value to a WML variable. WMLBrowser.setVar("message", "Hello World. Welcome to our WMLScript tutorial."); The refresh() function is used to instruct the WAP browser to refresh the current WML card. WMLBrowser.refresh(); to refresh the WML card so that the change made to the message variable is shown on the screen of the mobile device. To call the WMLScript function helloWorld() in the WML document, we use the URL below: helloWorldEg1.wmls#helloWorld()

A function in WMLScript is defined using the following format [extern] function function_name([argument1, argument2...]) { WMLScript statements here [return (some_value);] }

wmlscript_1.wmls file contains the following function wmlscript_function(): extern function wmlscript_function() { return "Welcome to our WMLScript tutorial"; }

To call wmlscript_function() from a WML card, create an anchor link using the following WML markup. The script will be executed if you click the anchor link. Execute Script Or Execute Script Another way to call wmlscript_function() in a WML card is to place the URL in a WML event handler. The script will be executed when the WML event occurs. The following markup instructs the WAP browser to call wmlscript_function() when the ontimer event is triggered: Four event types are supported in WML. They are ontimer, onenterbackward, onenterforward and onpick.

Passing Arguments to Functions Function called addition() that takes two numbers as its arguments: extern function addition(number1, number2) { WMLBrowser.setVar("message", number1 + number2); } To pass two integers 10 and 11 to addition(), use the following WML markup: Execute Script

Execute Script... When the WAP browser comes across the terms $(wmlVar1) and $(wmlVar2), it will substitute them with their stored value. So, the WML markup: Execute Script will become: Execute Script

WMLScript Example currency_wml currency_wmlscript validateform_wml validateform_wmlscript alert_wml alert_wmls pass by reference_wml pass by reference_wmls