Wireless Markup Language Script(WMLScript) by R4R Team

WMLScript:

WMLScript Stand for(Wireless Markup Language Script) is the part of WML. It is a client-side scripting language that is very similar to JavaScript.
it has some diffrences with javascript.WMLScript (Wireless Markup Language Script) is the client-side scripting language of WML (Wireless Markup Language). A scripting language is similar to a programming language, but is of lighter weight. With WMLScript,
the wireless device can do some of the processing and computation.WMLScript mostly uses in j2me .

Syntax of WMLScript:

WMLScript is case-sensitive.

The smallest unit of execution in WMLScript is a statement and each statement must end with a semicolon (;).

Comments can either be single-line (beginning with //) or multi-line (bracketed by /* and */). This syntax is identical to both C++ and Java.

A literal character string is defined as any sequence of zero or more characters enclosed within double ("") or single (‘) quotes.

Boolean literal values correspond to true and false.(same other languages)

New variables are declared using the var keyword (i.e. var x;)

WML Script Operators:

WML Script supports following type of operators these are:

Comparison Operators

Logical (or Relational) Operators

Assignment Operators

Arithmetic Operators

Conditional (or ternary) Operators

Check for complete detail of The WML Operators.

WML Script flow Control Statements:

Control statements are used for controlling the sequence and iterations in a program.

while Making variable iteration loop

break Terminates a loop

Statement Description

if-else Conditional branching

for Making self-incremented fixed iteration loop

continue Quit the current iteration of a loop

Difference between WMLScript and JavaScript,Some diffrences are:

                  WMLScript JavaScript
WMLScript is used with the WML pages,. whereas JavaScript is used with the HTML pages and it is not compatible with WML.
WMLScript comes under WML only. whereas  JavaScript is the part of the WAP or Wireless Application Protocol,
WMLScript is used for the client side scripting and it is not different from JavaScript, whereas JavaScript is used for performing tasks like user input validations and generating of error messages.
WMLScript uses the ECMAScript but it is not compatible with the JavaScript, whereas JavaScript is fully compatible with the HTML.
 
 WMLScript code is written in a file and is placed in the document, whereas JavaScript code is embedded in HTML language

Example:the hello world example:

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml1.3.dtd">

<wml>

<card id="card1" title="WMLScript ">

<p>

<a href="helloWorldEg1.wmls#helloWorld()">Run WMLScript</a><br/>

$(message)

</p>

</card>

</wml>

extern function helloWorld()

{

WMLBrowser.setVar("message", "Hello World.");

WMLBrowser.refresh();

}

Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!