General discussion

  • Creator
    Topic
  • #2130807

    a delay or pause function in javascript

    Locked

    by gsuruy ·

    I need a function like pause or delay to use in javascript in order to wait some seconds before calling another function withe the setTimeout function of javascript. Any help will be very welcome.

    Best regards.

All Comments

  • Author
    Replies
    • #3546536

      a delay or pause function in javascript

      by tjc ·

      In reply to a delay or pause function in javascript

      the below is a snipit of code that will pause the script for 5 seconds. Call it like any other function in javascipt.

      // pause delay for 5 seconds
      function pause() {
      var now1= now2= diffrence = ‘ ‘;
      now1 = new Date();
      now2 = new Date();
      while (diffrence < 5000) { now2 = new Date(); diffrence = Date.parse(now2) - Date.parse(now1); } //end while 5 second delay }

      • #3449319

        a delay or pause function in javascript

        by gsuruy ·

        In reply to a delay or pause function in javascript

        Thanks a lot for your valuable response, because of the everyday hurries i forto to say thanks.

        Have a nice day.

        gsuruy.

    • #3449318

      a delay or pause function in javascript

      by gsuruy ·

      In reply to a delay or pause function in javascript

      This question was closed by the author

Viewing 1 reply thread