12.14.3     GetVal and SetVal

 

/* GETVALandSETVAL.js - a JScript

 A simple script to Get the value of a Tag.

 add one to it.

 Set the value of the tag to the new value.*/

 

/* The type of the expressions determines the behavior

of the + operator in JScript.

If Both expressions are numeric or Boolean Then Addition.

If Both expressions are strings Then Concatenate

If One expression is numeric and the other is a string Then Concatenate

GETVAL returns even numbers as a STRING.

I used multiplication to force evaluation as of the GETVAL as

a number and hence use addition and not concatenation

*/

 

var value1;

value1 = GETVAL("SPEED") * 1.0  + 1;

SETVAL("SPEED=" + value1);