facebook

Calling Javascript functions

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #341195 Reply

    Andrew
    Member

    Hi,
    I am new to app development however used to program PLSQL many years ago.
    I am trying call a simple function from the a button, when action ‘on click’ calls a function.

    I have put a function call like this:
    example(1,’house’);

    and in the xxxx_custom.js file put the code:
    function example(a,b) {
    number += a;
    alert(‘You have chosen: ‘ + b);
    }

    Nothing happens. Any ideas to kick me along writing functions.
    Also can you use the debugger in the xxx_custom.js file?

    Thank you
    Andrew

    #341200 Reply

    Stu Wade
    Member

    Assuming you have declared number as a global variable, the example above should work, although I would have written the button code as:

    return example(1,’house’);

    And yes – my normal MO is to open the runtime select tools|debugger and watch for the little red crosses in the bottom right hand corner – clicking on the cross locates the error in the appropriate file.

    #341224 Reply

    Andrew
    Member

    Thanks Stu

    I will try it
    Cheers Andrew

    #341274 Reply

    Andrew
    Member

    Hi,
    It works well, however when an alert pops up, in BOLD it shows a path
    ie: http://v23.mobioneappcenter2.appstot.com

    .. then the alert message.

    Any way of not showing the path, just the intended message? Happens in both test and web app.

    Cheers
    Andrew

    #341276 Reply

    support-michael
    Keymaster

    >Any way of not showing the path, just the intended message?

    Only in a native apps can the alert() dialog omit the file location. In a webapp the standard javascript alert() dialog is displayed.

    #341278 Reply

    Andrew
    Member

    Thank you,

    Guess I will have to signup to apple to produce a native app,

    Cheers
    Andrew

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Calling Javascript functions

You must be logged in to post in the forum log in