PDA

View Full Version : problem in Loading JS file


nagasampath
04-25-2009, 10:18 PM
I am including a javascript file in lzx file. on a button click I need to get the funtion in javascript for example

<include href="ChangeURL.js" />
<handler name="onclick">
var temp = this.parent.datapath.xpathQuery('encoded/text()');
var test="test()"; //function in javascript located in the ChangeURL.js file
lz.Browser.callJS("" + test + "", this.gotReturn, temp);

<method name="gotReturn" args="r">
Debug.debug('gotReturn', r);
</method>

Here I am not able to fetch that test() function from javascript, Please help me.

Thanks

naso
04-26-2009, 07:09 AM
Try this:


<script src="ChangeURL.js" />

nagasampath
04-27-2009, 03:26 AM
Tried this out.. But still no luck.

naso
04-27-2009, 03:34 AM
var test="test()";

... or ...

var test = test();


the variable test is supposed to be the string "test()" or whatever the function test() returns?

Naso.

ptw
04-27-2009, 06:01 AM
You don't need to use callJS to call javascript that is included in your application. That is for calling external javascript.

<include href="ChangeURL.js" />
<handler name="onclick">
Debug.debug("Result: %w", test(this.parent.datapath.xpathQuery('encoded/text()')));
</handler>