How to load JS after being on the page for a certain amount of time?

Discussion in 'JavaScript' started by bob23, Dec 26, 2009.

  1. #1
    I want to have a piece of JavaScript execute after you have been on the page for a certain amount of time, for example, three minutes. I feel like this could be a simple question but I only know some basic JS.

    Can anyone help?
     
    bob23, Dec 26, 2009 IP
  2. Dondon2d

    Dondon2d Peon

    Messages:
    3,193
    Likes Received:
    146
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use Javascript's setTimeout() function. Its usage is somewhere in the line of:

    setTimeout ( expression, timeout );
    Code (markup):
     
    Dondon2d, Dec 26, 2009 IP
    bob23 likes this.
  3. bob23

    bob23 Peon

    Messages:
    117
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you! I'll look into using that function!
     
    bob23, Dec 26, 2009 IP
  4. Dondon2d

    Dondon2d Peon

    Messages:
    3,193
    Likes Received:
    146
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yep, if you need help you can paste the code here and say what you exactly want done.
     
    Dondon2d, Dec 26, 2009 IP