facebook

page m1- not found AND Alert repeated infinite times

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

    adikate
    Member

    hello i am doing a simple countdown timer in html. i done everything like adding additional project filles, etc when i run the first page its running but when time=0 its not going to another page and alert is repeated unlimlited times.

    
    <div id="1">
    </div>
    
    <script>
    
    (function(count) {
       setInterval(function() {
          if( count === 0) {
              phoneui.alert('YOU ARE REDIRECTED TO PAGE 2');
              phoneui.gotoPage("m1-2",'NONE');
          }
          else {
              document.getElementById('1').innerHTML = 'Count Down Time: ' + (count/1000);
              count -= 1000;
              
          }
       }, 1000);
    }(10000));
    </script>
    
    
    

    i am attaching my files.

    Attachments:
    You must be logged in to view attached files.
    #339803 Reply

    Stu Wade
    Member

    Problems have been reported with using .mobi names that start with digits.
    Try renaming 2.mobi to Two.mobi

    #339810 Reply

    adikate
    Member

    i renamed and still the same error and Alert is repeated infinite terms but i need it only once. Please someone there where the problem is…

    #339812 Reply

    Stu Wade
    Member

    setInterval repeats the function
    setTimeout does it once

    #339817 Reply

    adikate
    Member

    i changed my function to setTimeout but the count down not working i.e., it stopped at 10. Hope someone there to solve what going wrong in my files…

    #340013 Reply

    Hi adikate,

    I’ve noted that you have the same code in your second screen. In order to make your snippet work, let’s try the next:

    1) Remove (make a backup first) the javascript code in your secondary screen (2.mobi)
    2) Rename 2.mobi to Two.mobi
    3) Change the target of phoneui.gotoPage in your code of 1.mobi to: phoneui.gotoPage(“#m1-Two”,’NONE’);
    4) With these changes, your timer should work properly. You can add a toolbar or navigation widget including the title of secondary screen that will help you realize that the transition was complete successfully.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: page m1- not found AND Alert repeated infinite times

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