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
.
December 01, 2008, 01:39:18 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home (Index)
Code Repository
Javascript & AJAX
Delay code execution
Pages: [
1
]
« previous
next »
Print
Author
Topic: Delay code execution (Read 794 times)
Docthorn
n00b
Offline
Posts: 9
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
perkiset
Olde World Hacker
Administrator
Lifer
Online
Posts: 5211
:sniffle: Humor was so much easier before.
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
If I can't be Mr. Root then I don't want to play.
Docthorn
n00b
Offline
Posts: 9
Re: Delay code execution
«
Reply #2 on:
April 22, 2007, 10:33:59 PM »
Great. Simpler than I tought, thank you perkiset.
Doc
Logged
perkiset
Olde World Hacker
Administrator
Lifer
Online
Posts: 5211
:sniffle: Humor was so much easier before.
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
If I can't be Mr. Root then I don't want to play.
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Welcome to The Cache
-----------------------------
=> Init() - New Member Introductions
=> Efficient Cache Access Functions (aka User Tips)
=> I/O Protocols (Forum Rules)
=> Callback Routines
=> Coder's World Beat
=> The Tao of Programming
=> freemem() & garbage collection
-----------------------------
phpMyIDE
-----------------------------
=> Announcements & Updates
=> Support Threads
=> Tips, Tricks & Techniques
-----------------------------
Discussion Boards
-----------------------------
=> AJAX
=> ASP & .NET
=> C/++/#, Java, Delphi and other heavies
=> ColdFusion
=> Database Discussion (MySQL, Oracle and such)
=> General Discussion
=> JavaScript
=> Mac & iPhone Stuff
=> Music & Music Technology
=> PERL Coding & Best Practices
=> PHP
=> Python, Lisp/Scheme
=> *n[ui]x & OS-X
=> SMF Discussion
=> All things Windows
-----------------------------
Code Repository
-----------------------------
=> C / C++ / C#
=> ASP / .NET
=> Cold Fusion
=> Javascript & AJAX
=> Lisp (++Scheme) and such
=> PERL
=> PHP
=> Python
=> Regex
=> Shell Scripting
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...