×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    25

    Question Script not getting executed.Alert and Button on clicking does not work .

    Hi!
    I am developing a series 40 app. In this on the last screen I have put a button which when clicked should display a value "x" which is found in the function FindAge defined in the <script> part.
    But when I click the button nothing happens. Also I put an alert in the function to return the value of x even the alert does not appear.
    I have included the code below.
    Kindly help to display the value of x.
    Ruth
    The code follows below
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>PhoneKnowsYourAge</title>
    <link href="s40-theme/css/s40-theme.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="s40-theme/js/screensize.js"></script>
    <script type="text/javascript">
    function FindAge(){
    var x=document.forms["ruthform"]["EnterResult"].value
    //business logic x=*****;
    alert("your age is "+ x);
    return x;
    }
    </script>
    <body>
    <form name="ruthform" method="post" action="return FindAge();">

    ____________
    _____________________
    _____________________
    <div id="STEP6" style="font-size: large; font-weight: bold; font-style: italic; color: #800080; background-color: #FFFFFF; ">
    <p>Now enter the result that you have got in the text field below and press the submit button.</p>
    <input type="text" name="EnterResult">
    <button name="EnterResultButton" class="ui-button_S40button" onclick="mwl.toggle('#STEP6'); mwl.toggle('#STEP7')">
    Submit </button>
    </div>

    <div id="STEP7">
    <button onclick="FindAge();">Click Me to get Your age </button>
    <p>The result: Your real age is</p>
    </div>
    </form>
    </body>
    </html>

  2. #2
    Registered User
    Join Date
    Mar 2013
    Location
    United Kingdom
    Posts
    161

    Re: Script not getting executed.Alert and Button on clicking does not work .

    the alert() function is not supported in a Nokia Web App.

    If you want to debug, run your Nokia application in debug mode and use the below line to view debug output in the console.

    Code:
    console.log();

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: Script not getting executed.Alert and Button on clicking does not work .

    It may be useful to point out the FAQ here. It is an interesting reading in general, and also mentions this alert restriction for example: http://www.developer.nokia.com/Commu...lert.28.29_.3F

  4. #4
    Registered User
    Join Date
    Jul 2012
    Posts
    13

    Re: Script not getting executed.Alert and Button on clicking does not work .

    Actually, alert is working when you are working with Simulator - Local Preview, and as far as I know, Local Preview is intended to do debugging. So, alert will work there.
    But it won't work in Cloud Preview and Real Devices.

    Extra Notes:
    Since Local Preview is only for debugging, what you see in it will be different on what you get in the device. So, for UI and designing, stick with the Cloud Preview.

  5. #5
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,800

    Re: Script not getting executed.Alert and Button on clicking does not work .

    Quote Originally Posted by e4studio View Post
    Actually, alert is working when you are working with Simulator - Local Preview, and as far as I know, Local Preview is intended to do debugging. So, alert will work there.
    The Simulator browser component is WebKit based and the real device browser is Gecko based. So everything that works on the simulator doesn't work on the real device.

    If you ask me, the simulator should have had Gecko based browser too...
    Pankaj Nathani
    www.croozeus.com

Similar Threads

  1. Turn on flashlight by clicking button
    By mind_freak in forum [Archived] Qt Quick
    Replies: 3
    Last Post: 2012-04-10, 04:53
  2. Replies: 7
    Last Post: 2011-12-21, 05:58
  3. Getting message ids by clicking on a button
    By mind_freak in forum [Archived] Qt Mobility Project
    Replies: 2
    Last Post: 2011-10-26, 06:52
  4. Replies: 1
    Last Post: 2008-01-28, 11:04
  5. Replies: 0
    Last Post: 2007-11-30, 05:18

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×