The Syndk8 - Black Hat SEO Paradise
Fantomaster - Industrial Strength Black Hat SEO Tools
Affiliate Earners: Affiliate Programs
Home
Help
Search
Login
Register
RSS for SEOIdiot
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 25, 2012, 05:01:44 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home (Index)
Level 2 Cache: Speciality Items
JavaScript
Delay code execution
Pages: [
1
]
« previous
next »
Print
Author
Topic: Delay code execution (Read 4353 times)
Docthorn
Rookie
Offline
Posts: 10
Delay code execution
«
on:
April 22, 2007, 04:54:56 PM »
Question.
Is it possible to delay the execution of a javascript script?
For example I open somesite/page1 and after 5 seconds the page executes some javascript.
If not, can I get around this with a PHP page that after five seconds loads a frame, and inside the frame the page with the javascript code? I'm brainstorming a bit to find possible solutions so forgive me if what I said makes no sense.
Ciao,
Doc
Logged
No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
Offline
Posts: 9896
Re: Delay code execution
«
Reply #1 on:
April 22, 2007, 05:18:19 PM »
Very simple:
setTimeout('theFunctionYouWantToCall()', 5000);
This would do exactly what you are trying to accomplish, provided the function had your redirect code...
function theFunctionYoWantToCall()
{
top.lcation='
http://www.spamsite.com
';
}
You may also put pure code right in there:
setTimeout("top.location='
http://www.thespamsite.com
'", 5000);
/p
Logged
It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Docthorn
Rookie
Offline
Posts: 10
Re: Delay code execution
«
Reply #2 on:
April 22, 2007, 10:33:59 PM »
Great. Simpler than I tought, thank you perkiset.
Doc
Logged
No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
Offline
Posts: 9896
Re: Delay code execution
«
Reply #3 on:
April 23, 2007, 08:49:35 AM »
No worries.
Since we're at it, there is another handy function along these same lines: setInterval(jsCode, intervalMS) which does the same as setTimeout except that it does it repeatedly at intervalMS. Excellent for beacons and such.
/p
Logged
It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Level 1 Cache: General Discussion
-----------------------------
=> Init() - New Member Introductions
=> NEW BOARD: The n00b Zone
=> Callback Routines
=> Recovered Sectors
=> freemem() & Garbage Collection
=> All Things General Tech
=> All Things Android
=> All Things Apple
=> All Things Database
=> All Things Microsoft
=> All Things *nix
-----------------------------
Level 2 Cache: Speciality Items
-----------------------------
=> AJAX
=> ASP & .NET
=> C/++/#/Objective, Java, ObjectPascal
=> CSS, HTML & SEO, Cloaking
=> JavaScript
=> Music Technology
=> PERL
=> PHP
=> Obscurites, Curiosities & Arcanity
=> Regex
-----------------------------
Frameworks, Applications & Projects
-----------------------------
=> phpMyIDE
=> The iPhone SMF Theme Project
=> SMF
-----------------------------
Retired Boards
-----------------------------
=> ColdFusion
=> phpMyIDE
=> SalesForce / Apex
=> Javascript Code Repository & Examples
=> PHP Code Repository / Examples
Perkiset's Place Home
Best of The Cache
phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's
Pinkhat's Perspective
cache
mart
coder
programmers
ajax
php
javascript
Loading...