PDA

View Full Version : Invoking Javascript in a method


wcwilson
04-03-2003, 12:08 PM
Hi,

I am confused about how we can invoke JavaScript methods in a method tag.

When I invoke the following method:

<method name="loadContacts">
var testText = encodeURI("Hello World");
</method>

I get this error:

contacts.lzx:112: call to undefined function 'encodeURI'

This is a valid root function that I can call in any JavaScript function, like my example below:

function test() {
var testText = encodeURI("Hello World");
alert(testText );
}

What do I need to do to call a root JavaScript function? Or is this not possible? I feel like I am not clear on the concept...

Thanks,

--Wayne

antun
04-03-2003, 12:43 PM
Hey Wayne

Use:

escape( "Hello World" );

instead.

This is a common problem. When developers hear the word "JavaScript" they immediately think it is the same as web browsers' implementation of JavaScript.

LZX supports most of JavaScript, as defined by ECMA-262. The browsers have added a bunch of functions (such as encodeURI() and alert()) that go beyond the standard.

ECMA-262:

http://www.ecma-international.org/publications/files/ecma-st/Ecma-262.pdf

-Antun