Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > setTimeout

Reply
Thread Tools

setTimeout

 
 
Simon
Guest
Posts: n/a
 
      03-15-2007
Hi everybody

I have a function, called "Terug"
Within that function i want to go to another function (named Frames) after
let's say, 2 seconds.
How can I do that?

function Terug() {
some code
etc etc
etc etc

window.setTimeout(Frames,2000)
}
Function Frames() {
alert ('hello');
}

This doesn't work.
Any ideas?


 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      03-15-2007
Simon wrote on 15 mrt 2007 in comp.lang.javascript:

> window.setTimeout(Frames,2000)
>}
> Function Frames() {
> alert ('hello');
>}
>
> This doesn't work.
>


setTimeout(Frames(),2000)

Voor oude browsers zelfs:

setTimeout('Frames()',2000)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Simon
Guest
Posts: n/a
 
      03-15-2007
Ok thanks, but when i place it in an "if-argument" it does go to the next
function but it doesn't wait for two seconds anymore..
This is the script: If the first url is equal to the next url (like it is in
my example) it must wait 2 seconds and then continue with function Frames().

function Terug() {
location.href =
"http://10.10.25.197/scripts/mgwms32.dll?MGWLPN=TONED&LID=6070430448788&^VAR(LI D,7)=^TO2001300B&DIS=KOSTENB"
;
if
('http://10.10.25.197/scripts/mgwms32.dll?MGWLPN=TONED&LID=6070430448788&^VAR(LI D,7)=^TO2001300B&DIS=KOSTENB'=='http://10.10.25.197/scripts/mgwms32.dll?MGWLPN=TONED&LID=6070430448788&^VAR(LI D,7)=^TO2001300B&DIS=KOSTENB')
{
window.setTimeout(Frames(),2000);
}
}
function Frames() {
if(parent.framesetgbv.cols=='0,*')
{ btr='700,*' }
else { btr=parent.framesetgbv.cols }
if (parent.framesetgbv.cols == "0,*")
{FrameSize = "700,*" }
if (parent.framesetgbv.cols == btr)
{ FrameSize = "0,*" }
parent.framesetgbv.cols = FrameSize;
}

"Evertjan." <(E-Mail Removed)> schreef in bericht
news:Xns98F480115C3BCeejj99@194.109.133.242...
> Simon wrote on 15 mrt 2007 in comp.lang.javascript:
>
>> window.setTimeout(Frames,2000)
>>}
>> Function Frames() {
>> alert ('hello');
>>}
>>
>> This doesn't work.
>>

>
> setTimeout(Frames(),2000)
>
> Voor oude browsers zelfs:
>
> setTimeout('Frames()',2000)
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)



 
Reply With Quote
 
RobG
Guest
Posts: n/a
 
      03-15-2007
On Mar 15, 10:24 pm, "Simon" <(E-Mail Removed)> wrote:
> Ok thanks,


Please don't top-post, reply below trimmed quotes.

> but when i place it in an "if-argument" it does go to the next
> function but it doesn't wait for two seconds anymore..


You didn't follow Evertjan's post closely enough...

[...]

> window.setTimeout(Frames(),2000);



setTimeout( 'Frames()', 2000 );}

Note the quotes around the function call - without them, the function
is executed immediately. There is also no need to include the window
object reference.


--
Rob

 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      03-15-2007
I'm sorry, don't know how this works. (Newsgroup) I will figure out what you
mean by top-posting.

When I place the '-mark around the functioncall it doesnt work at all.





"RobG" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed) oups.com...
> On Mar 15, 10:24 pm, "Simon" <(E-Mail Removed)> wrote:
>> Ok thanks,

>
> Please don't top-post, reply below trimmed quotes.
>
>> but when i place it in an "if-argument" it does go to the next
>> function but it doesn't wait for two seconds anymore..

>
> You didn't follow Evertjan's post closely enough...
>
> [...]
>
>> window.setTimeout(Frames(),2000);

>
>
> setTimeout( 'Frames()', 2000 );}
>
> Note the quotes around the function call - without them, the function
> is executed immediately. There is also no need to include the window
> object reference.
>
>
> --
> Rob
>



 
Reply With Quote
 
RobG
Guest
Posts: n/a
 
      03-15-2007
On Mar 15, 11:06 pm, "Simon" <(E-Mail Removed)> wrote:
> I'm sorry, don't know how this works. (Newsgroup) I will figure out what you
> mean by top-posting.


Top-posting is putting your reply at the top and leaving the post that
you are replying to at the bottom. It is much more efficient to trim
the stuff you aren't interested in and reply below the bits you want
to comment on.

Read a few other posts here to get the idea.


> When I place the '-mark around the functioncall it doesnt work at all.


Then you have some other error - try the following simple example:

<script type="text/javascript">

function sayHi(){alert('Hi');}

function foo() {
setTimeout('sayHi();', 2000);
}

foo();

</script>


--
Rob

 
Reply With Quote
 
scripts.contact@gmail.com
Guest
Posts: n/a
 
      03-15-2007
On Mar 15, 7:06 am, "Simon" <(E-Mail Removed)> wrote:

> When I place the '-mark around the functioncall it doesnt work at all.
>


Try -
setTimeout(function(){ Frames() },2000);

 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      03-16-2007

> Try -
> setTimeout(function(){ Frames() },2000);


Thanks, i tried it, but, unfortunately, it doesn't work. Does it have
something to do with the if-argument?
The line that worked best so far was: setTimeout(Frames,2000);
Only now it goes immediately to the function Frames, and totally ignores the
2 seconds.


 
Reply With Quote
 
Dr J R Stockton
Guest
Posts: n/a
 
      03-16-2007
In comp.lang.javascript message <(E-Mail Removed)
glegroups.com>, Thu, 15 Mar 2007 06:34:29, RobG <(E-Mail Removed)>
posted:
>On Mar 15, 11:06 pm, "Simon" <(E-Mail Removed)> wrote:
>> I'm sorry, don't know how this works. (Newsgroup) I will figure out what you
>> mean by top-posting.

>
>Top-posting is putting your reply at the top and leaving the post that
>you are replying to at the bottom. It is much more efficient to trim
>the stuff you aren't interested in and reply below the bits you want
>to comment on.
>
>Read a few other posts here to get the idea.


Better IMHO to say "Read FAQ 2.3 paragraph 6", and give the URL of the
FAQ. That way, the questioner is encouraged to learn more than by
reading a few past articles.

A. <FAQENTRY> Even if the paragraphs of 2.3 cannot be sub-numbered as
by <OL>, it's always possible to type the necessary digits (or letter)
at the beginning of each paragraph. But it would be better split into
Reading, Asking, Replying, preceded by General.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript setTimeout does not work =?Utf-8?B?RQ==?= ASP .Net 4 05-02-2006 08:21 PM
setTimeout JR HTML 3 04-15-2004 12:07 PM
settimeout j van c HTML 5 12-07-2003 09:08 AM
socket settimeout ? Colin Brown Python 0 12-03-2003 12:28 AM
Smart navigation and js setTimeout Andy Pickering ASP .Net 1 10-27-2003 10:51 AM



Advertisments