/    Sign up×
Community /Pin to ProfileBookmark

Help me asap ??

This code will open a page after 8 seconds. Now I want after it open 20 pages it will stop and run again after 15 minutes.
Someone can help me ?? ASAP
Thanks.

[code=html]
<SCRIPT LANGUAGE = “JavaScript”>
<!–
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer() // run this function following to the <body onLoad> tag
{
secs = 8
StopTheClock()
StartTheTimer()
}

function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}

function StartTheTimer()
{
if (secs==0)
{
StopTheClock()

window.location = “<?php echo $_SERVER[‘SCRIPT_NAME’];?>/”+”<?php echo rand(100,999);?>”
}
else
{
self.status = secs
secs = secs – 1
timerRunning = true
timerID = self.setTimeout(“StartTheTimer()”, delay)
}
}
//–>
</SCRIPT>
[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@UltimaterDec 12.2005 — Since after the page URL changes the page starts afresh and all variables cleared, you will need to do one of the following.
[list=1]
  • [*]Use frames

  • [*]Use popups

  • [*]Use the QueryString

  • [*]Use cookies

  • [*]Use sessions

  • [*]Use multiple pages

  • [*]Go server side

  • [*]Use a totally different JavaScript to simulate the same effect desired

  • [/list]


    The best choice depends on what you are trying to do exactly.

    Are you trying to merely refresh the page?
    ×

    Success!

    Help @raven80 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.1,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,
    )...