facebook

Timeout Script Confusion

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #341272 Reply

    anser
    Member

    Hello Support & forum
    I have run in some problem with a simple timer JS and need some help I try to explain the best I can since I’m very beginner with JS won’t be easy. This timer script does nothing else then shows the passed time no other action. When I use this script on single screen app attached – 1b.mobi the script value is set for 2 sec, 4 sec, and 6 sec. and shows the user the passed time one by one as it should be and its works fine. Here it is!

    1b.mobi /SINGEL PAGE APP/ 1b.mobi

    <script>
    function timedText()
    {
    var x=document.getElementById(‘txt’);
    var t1=setTimeout(function(){x.value=”2 sec”},2000);
    var t2=setTimeout(function(){x.value=”4 sec”},4000);
    var t3=setTimeout(function(){x.value=”6 sec”},6000);
    }
    </script>
    <form><center>
    <input type=”button” value=”Start 2 4 6″ onclick=”timedText()” />
    <input type=”text” id=”txt” /></center></form>

    However when I try to use the same script three value and another single value in a two page app first PG1 is 1.mobi the script is exactly the same as 1b.mobi. While in PG2 is 2.mobi having a single value script 10 second timer. After run in test center the script on PG1 instead of show the value 2 sec, 4 sec, 6 sec, only shows the PG2 10 second timeout value. While on PG2 nothing on the single value script.

    SCRIPT 1
    <script>
    function timedText()
    {
    var x=document.getElementById(‘txt’);
    var t1=setTimeout(function(){x.value=”2 sec”},2000);
    var t2=setTimeout(function(){x.value=”4 sec”},4000);
    var t3=setTimeout(function(){x.value=”6 sec”},6000);
    }
    </script>
    <form><center>
    <input type=”button” value=”Start 2 4 6″ onclick=”timedText()” />
    <input type=”text” id=”txt” /></center></form>

    And the other screen PG2 single value timer is set for 10 second
    SCRIPT 2

    <script>
    function timedText()
    {
    var x=document.getElementById(‘txt’);
    var t1=setTimeout(function(){x.value=”10 sec”},10000);
    }
    </script>
    <form>
    <input type=”button” value=”Wait6 sec!” onclick=”timedText()” />
    <input type=”text” id=”txt” />
    </form>

    First I used MobiOne Version 2.3.1 then since I was ready to upgrade and try MobiOne Version 2.5.1dev. I tested in both versions. In MobiOne 2.3.1 I placed these two scripts in a multi Page widget. Script 1 in multi page1 and the script 2 in the multi page2 the navigation worked fine but, the result on PG1 instead of show the value 2 sec, 4 sec, 6 sec, only show PG2 10 second timeout value. While on PG2 nothing on the single value script.

    Then I experienced in version 2.5.1 dev. And created individual screens app PG1=1.mobi and another screen PG2= 2.mobi. This time I got the same problem on the PG1 timers with three values shows the PG2 10 second timer value. When I first run the script on PG2 it starts the timeout value on PG1 and nothing on PG2. Another problem I got on PG2 – 2.mobi screen the navigation button disappeared.
    Sorry if this is too confusing the way I explained but that’s what the app does.
    Can anyone help me what I do wrong or how I can fix it?
    Lots of thanks in advance

    Attachments:
    You must be logged in to view attached files.
Viewing 1 post (of 1 total)
Reply To: Timeout Script Confusion

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