View Full Version : code executes in wrong order?

05-05-2006, 08:51 AM
I'm having a problem with code executing in the wrong order. I have 2 things I want to do at a given point in the program, however in IE, this isnt working unless an alert is placed between the 2, so I tried to simulate an alert by using a custom wait function so it should execute the first line, wait for 1second and then execute the second line. This is not what happens. The wait happens first. so in FF it waits 1s then does the first line then the second. In ie it waits 1s then does the second and the last doesnt appear to run, so it maybe that its doing the 3rd line before the 1st line.

document.getElementById("quote").innerHTML = xmlhttp.responseText;

Philip M
05-05-2006, 09:04 AM
Does this help?


05-05-2006, 11:57 AM
I think I know what the issue is - everyline is executed in order, but without waiting for the previous line to finish... which seems odd to me but I've managed to cobble together a workaround using setTimeout()

Philip M
05-05-2006, 04:49 PM
As one nut to another :cool:

I have also encountered this or something similar:-

Here is a small fragment of some code I cobbled to get round the problem:-

var blurReset = 1;
if (blurReset == 1) { // do a whole raft of things
if (entry) {thenumber.value = tpyrcne(entry)}
return false;

// ----------------------------------------

function blurForm(thenumber) {
thenumber.blur(); // required to overcome bug in IE
blurReset = 0;
setTimeout ("blurReset = 1", 250); // quarter of a second delay

Hope this points you in the right direction. It is a long time since I fixed
this IE problem so I have forgotton some of the details.