how to stop the exeution of a javascript function for few seconds
-
in vb.net we can stop the fuctionality of a code for some time usig threads.in the same way is it possible to stop a javascript fuction for some time
Not really. Javascript is strictly single threaded, so if you pause the script for a few seconds, the browser freezes up totally and does nothing until the script continues. If you want the execution of a script to continue after a while, use a timeout to start a function:
function work() {
// do something
window.setTimeout('work2();', 5000); // continue after 5 seconds
}function work2() {
// continue doing something
}Experience is the sum of all the mistakes you have done.
-
Not really. Javascript is strictly single threaded, so if you pause the script for a few seconds, the browser freezes up totally and does nothing until the script continues. If you want the execution of a script to continue after a while, use a timeout to start a function:
function work() {
// do something
window.setTimeout('work2();', 5000); // continue after 5 seconds
}function work2() {
// continue doing something
}Experience is the sum of all the mistakes you have done.
-
function work() { // do something window.setTimeout('work2();', 5000); // continue after 5 seconds}function work2() { // continue doing something} sir will u explain once again plz..this example Thanks in advance....