I've gathered that javascript doesn't have a handy wait() function, so
I made the following function makeDelay() to make use of PHP's sleep(),
which then does the waiting, and responds with "done"...my problem is
that the javascript doesn't wait for makeDelay(secon ds) to finish...?
makeDelay(5);
iDontWaitForNob ody();
function makeDelay(secon ds) {
url="make_delay .php?delay=" + seconds;
http.open("GET" ,url,true);
loadStatus=docu ment.getElement ById("loadStatu s");
http.onreadysta techange=functi on() {
if (http.readyStat e==1) {
loadStatus.src= "balls/load1.gif";
}
if (http.readyStat e==2) {
loadStatus.src= "balls/load2.gif";
}
if (http.readyStat e==3) {
loadStatus.src= "balls/load3.gif";
}
if (http.readyStat e==4) {
if(http.respons eText == "done")
loadStatus.src= "balls/load0.gif";
}
}
http.send(null) ;
}
I made the following function makeDelay() to make use of PHP's sleep(),
which then does the waiting, and responds with "done"...my problem is
that the javascript doesn't wait for makeDelay(secon ds) to finish...?
makeDelay(5);
iDontWaitForNob ody();
function makeDelay(secon ds) {
url="make_delay .php?delay=" + seconds;
http.open("GET" ,url,true);
loadStatus=docu ment.getElement ById("loadStatu s");
http.onreadysta techange=functi on() {
if (http.readyStat e==1) {
loadStatus.src= "balls/load1.gif";
}
if (http.readyStat e==2) {
loadStatus.src= "balls/load2.gif";
}
if (http.readyStat e==3) {
loadStatus.src= "balls/load3.gif";
}
if (http.readyStat e==4) {
if(http.respons eText == "done")
loadStatus.src= "balls/load0.gif";
}
}
http.send(null) ;
}
Comment