473,795 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Repeat with pause

Hi there,

First off thank you for reading.

I'm trying to get the following to work.
I want a script that does the following 9 times: jah(urlOne); and then
1 time: jah(urlTwo); then it should start at the top again.
There has to be a break in between, thats why i have the wait function
there.
Hope anybody can help me because i'm not seeing my mistake and can't
think clear any more.

Thank you for reading.

<script language="javas cript" type="text/javascript">
var urlOne="message Center.php, msgOne";
var urlTwo="message Banner.php, msgOne";
var waitTime="1000" ;

alert (urlOne);

function wait(msecs)
{
var start = new Date().getTime( );
var cur = start
while(cur - start < msecs)
{
cur = new Date().getTime( );
}
}
alert (urlOne + " voor de statment");
jah(urlOne);
alert (urlOne + " na de statment");
wait(waitTime);

</script>

Mar 22 '08 #1
2 1407
"ZT**********@g mail.com" <ZT**********@g mail.comwrites:
Hi there,

First off thank you for reading.

I'm trying to get the following to work.
I want a script that does the following 9 times: jah(urlOne); and then
1 time: jah(urlTwo); then it should start at the top again.
There has to be a break in between, thats why i have the wait function
there.
Hope anybody can help me because i'm not seeing my mistake and can't
think clear any more.
You've not explained what's going wrong.

Anwyay:
function wait(msecs)
{
var start = new Date().getTime( );
var cur = start
while(cur - start < msecs)
{
cur = new Date().getTime( );
}
}
NEVER EVER DO THAT. It will use up 100% of your CPU and probably will
block your host (browser) completely until the timeout is
finished. Possibly the host will break your script to prevent that.

Use setTimeout() instead; something like:

var count = 0;
function nineTimes() {
if (count++ < 9) {
jah(urlOne);
setTimeout(nine Times, 1000);
}
else {
setTimeout(func tion() { jah(urlTwo) },1000);
}
}
nineTimes();
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Mar 22 '08 #2
Thank you all 3 of you, i'm amazed by the answer and the speed the
were provided in.
Will post my code and the site when i'm done.

Thanks again!

Gr,

Jeroen
Mar 23 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1893
by: Andrew | last post by:
When will .NET have a low-pause-time garbage collector A low-pause-time garbage collector would greatly improve .NET's ability to serve as a platform for soft real-time systems. It doesn't have to be perfect. For example, I'd be happy with something where there was at most one pause per second, each pause was less than .2 seconds, and half the process's memory was inaccessible to the application due to garbage collection management It...
5
4147
by: Brian.Steele | last post by:
Greetings everyone. See http://www.spiceisle.com/cgi-bin/slideshow/slideshow.cgi?dir=brian/personal/2005/uk_trip/images&type=jpg The "Pause" button works in IE, but not in Firefox. Any ideas why? If you have any other ideas on how the javascript can be improved, please let me know.
11
39908
by: Paminu | last post by:
Is there something like system("PAUSE") for linux?
8
36466
by: Wim | last post by:
My GUI application starts a process (a console program) when the user hits Play. I would like to add an option to pause that process. The code I've added to detect if the user hit pause/unpause seems to work. But I have no clue how to pause/suspend the process. As far as I can see the Process class doesn't offer anything for this. So it's probably the thread the process is running on that should be suspended or put to sleep. But just...
38
4015
by: Jackie | last post by:
I just want the programme to stop for a while. Thanks.
2
2277
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled.
6
4057
by: Peted | last post by:
Hi wondering what is the best way to do this Need a user to click a button, that sends 3 or 4 string based commands via a TCP/ip socket link I can connect to the ip device no problems, am using indy sockets, and can send information ok
8
11397
by: Lloydm | last post by:
I've used the command "pause" in batch files which works ok but I guess it's applied dirrently in c++. Using Dev C++ 4.0 and the following is my code #include<iostream> #include<iomanip> #include<cstdlib> #include<string> main(){
3
2626
by: garfunkel214 | last post by:
I have images and text rotating every 7000 ms using a setInterval. i am trying to implement a pause button that will stop the rotation when clicked. When clicked once more, I would like the rotation to continue. The first time that the pause button is clicked, the rotation stops and all is well. Click again and the rotation continues. But then i can't seem to pause thereafter. Where am i going wrong? function pause() { switch (p) {...
2
2626
by: bmerlover | last post by:
How do I use a PAUSE in .NET Framework using C++ (Visual Studio .NET 2003). I know it's system("pause") in the dos version. But I don't know what it is in the GUI version. I tried System::Windows::Forms::Pause and I also tried System::Windows::Forms::Pause *myPause = new System::Windows::Forms::Pause;
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10167
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9046
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.