Hi,
The following code fragment is bothering me way too much because it is running in a nonsensical fashion:
[CODE]
function popup(url, name, offset, modal) {
…
for(i = 0; i < pl; i++) {
if(pw[i].closed)
continue;
if(pw[i].name.equals(name))
break;
}
if(i == pl) {
pw[i] = window.open(url, name, “toolbar=no, menubar=no, copyhistory=no, location=no, scrollbars=yes”
+ “, screenX=” + x + “, screenY=” + y
+ “, top=” + y + “, left=” + x
+ “, width=” + width + “, height=” + height);
alert (“i: “+i+”npl: “+pl+”ni == pl ? “+(i == pl));
pl++;
}
else if(pw[i].closed) {
pw[i] = window.open(url, name, “toolbar=no, menubar=no, copyhistory=no, location=no, scrollbars=yes”
+ “, screenX=” + x + “, screenY=” + y
+ “, top=” + y + “, left=” + x
+ “, width=” + width + “, height=” + height);
}
}
As you have guessed this is the code for generating popup. Problem happens only with firefox and when a user double clicks the link corresponding to the popup.
The alert that is generated is completely weird. Double click causes to open 2 popups. For the first popup the output is shown in aberration.jpg. The output is ok. For the second popup the output is shown in aberration1.jpg. Here lies the problem. As you see from the code the alert is only shown when entering the first branch:
[CODE]if (i == pl)
so according to common sense when i and pl are equal then the execution would enter the if block and print the alert. But the output is showing that i = 0 and pl = 1 and i == poplen ? false.
How is this possible? if i != pl how can
[CODE]if (i == pl)
return true and the enter into the block?
Please help here. wasting too much time here.