Page 1 of 1

How Do I Call a Javascript function in a Javascript file?

Posted: Wed Nov 07, 2012 3:00 pm
by RichardGolko

I added a new javascript (create drop down) and put the following function in it:

function(addNumbers){
return 1+1;
}

I called the javascript object "addNumbers' without the quotes.

In a button on a screen I added a click handler and selected Run Custom JavaScript; I put the following for the javaScript:

var x = addNumbers();
alert(x);

But when I test and press the button nothing happens.

How do I call my custom function?

Also if I put 'alert' in the function, will that work (once I know how to call the function?)

Thanks.


How Do I Call a Javascript function in a Javascript file?

Posted: Wed Nov 07, 2012 3:17 pm
by RichardGolko

Never mind; It would help if I wrote the function correctly:
function addNumbers() {
return 1+1;
}

And yes, alerts can be included in the javascript functions.


How Do I Call a Javascript function in a Javascript file?

Posted: Sun May 26, 2013 10:44 am
by jimmy vu

this didn't work


How Do I Call a Javascript function in a Javascript file?

Posted: Sun May 26, 2013 11:09 am
by Igor

Hello,

It's works. Plese try to create a simple App: add button to screen and put JS code on button click event.

code
function addNumbers() {
return 1+1;
}
alert(addNumbers());
/code