Click to See Complete Forum and Search --> : Call two javascript function seprately.


amit.patel
06-08-2009, 09:16 AM
Hello all,

I have two javascript function which i want to call seprately.suppose we have two function function A and B. when A function is called then it will call same function simuntaniously for after 1 min using javascript setInterval() function and same way B function . so both function call indivusually.something like below.

function A()
{
A();
}

function B()
{
B();
}

so i need this two function execute seprately and simuntaniously on body onload event.

so how can i do this?

scrupul0us
06-08-2009, 09:58 AM
create an onload() function that loads each function

also, this belongs in the JS section, not the PHP section ;)

ednark
06-09-2009, 04:48 PM
I think this is what you are asking. If you call setTimeout() like so it will be running A and B at the same time. It should not wait until A has finished completely before running B.


setInterval( tickInterval, 1000 );
function tickInterval ()
{
setTimeout(function() { A(); }, 0);
setTimeout(function() { B(); }, 0);
}
function A () {}
function B () {}