"setTimeout" function won't work

This is a discussion on ""setTimeout" function won't work" within the JavaScript Forum section. This forum, and the thread ""setTimeout" function won't work are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 7th, 2006, 14:34
Up'n'Coming Member
Join Date: Aug 2006
Location: Peru
Age: 21
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
"setTimeout" function won't work

Hey programmers!!
I'm having big trouble trying to figure this one out. I have a page with a "Print All" button, but only one frame is showed at the time. The idea is to redirect the frame in order to get the next page, well, that part is already done, but I need to wait till the last page is printed so I can call the next one, therefore I use setTimeout function, but nothing happens. The excecution won't pause and I only get to print one page, besides the errors I get from redirecting so fast the frame. Well I'll leave my script, hoping somebody might help. Thanks...

while(parseInt(lastprinted)<parseInt(lastnumber)){
var frame=fraAux; //fraAux is the frame I'm using
lastprinted=fraAux.document.forms[0].hdnPag.value;// page counter
var s="Printing Page"+frame.document.forms[0].hdnPag.value+". Wait untill page is fully printed, then hit ''Ok''";
fraAux.location.href ="frmCodResult.aspx?Value="+sValue+"&Since="+sSinc e+"&Untill="+lastnumber+"&Begin="+(parseInt(lastpr inted)+1);
//redirects the frame and loads next page
factory.printing.print(false,frame); //send to printer without prompting
setTimeout('',10000); //this doesn't work
alert(s);// send an alert, so it'd "manually" wait
}
Reply With Quote

  #2 (permalink)  
Old Aug 7th, 2006, 16:14
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: "setTimeout" function won't work

You can't use setTimeout() the way you are trying to use it. It's not a delay loop like the delay() function you get in some languages.

You need to give it something to do. This goes where you have the '' in your code.

You can enter JavaScript directly in there or direct it to a function.

What you are effectively saying is; 'after the specified time delay - do this'.
Reply With Quote
  #3 (permalink)  
Old Aug 7th, 2006, 16:52
Up'n'Coming Member
Join Date: Aug 2006
Location: Peru
Age: 21
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: "setTimeout" function won't work

Thanks. Now I get it, setTimeout doesn't pause the excecution, it just does something at a certain time, and the rest goes on.
I solved the problem by using setInterval instead, that way I forget about the while loop.
Reply With Quote
Reply

Tags
quotsettimeoutquot, function, wont, work

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a "tag" system to find relevant "related" pages MrQuestions PHP Forum 3 Mar 20th, 2008 23:06
[SOLVED] Show "Image" Depends On User "Status"? Monie Classic ASP 6 Oct 16th, 2007 01:22
? IS "meta name="robots" content="?" necessary in pages ? Love2Java Starting Out 6 Aug 8th, 2007 13:48
window.opener.document["nameForm"].getElementById("someid").value; doesnt work drpompeii JavaScript Forum 0 Feb 17th, 2007 23:09
<option value="yes" class="x"> problem in Firefox mameha1977 Web Page Design 1 Jun 21st, 2006 11:20


All times are GMT. The time now is 01:11.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43