On Wed, 16 Nov 2011 17:17:57 -0800, Gene Wirchenko wrote:
> When I try to get it to do the looping for expansion to
> 130,000,000, I get the confirmation box [1] which I OK, I get the alert
box
> that it is starting [2], and THEN after a delay, I get the "Done" text
[3]. I
> do not get the alert box that the looping is complete [???] nor the one
that
> outputs fLooping [4]. There is no error from my browser either.
Looking just at the script element, and with a few markers added by
myself:
<script type="text/javascript">
theArray=new Array();
var OldMax=0;
var Expand=129000000;
var fLooping=true;
while (fLooping)
{ // while (fLooping) ->
fLooping=confirm("Confirm do Expand="+Expand); // [1]
if (fLooping)
{ // if (fLooping) ->
alert("doing Expand="+Expand); // [2]
for (var i=OldMax; i<Expand; i++) theArray[i]=i;
alert("done Expand="+Expand); // [3]
OldMax=Expand;
Expand+=100000;
} // <- if (fLooping)
} // <- while (fLooping)
alert("fLooping="+fLooping); // [4]
</script>
I'm having trouble working out which is the first alert that you don't
get, where you say "I do not get the alert box that the looping is
complete".
You describe 5 alerts in your explanation of what happens, but you only
have 4 alerts. I would assume that after a successful expand for
130,000,000, the next alert / dialog would be the confirm dialog for
131,000,000, but that doesn't match your description of the alert box
that you're expecting but don't receive.
If you are expecting the alert:
alert("fLooping="+fLooping);
to appear at the end of each loop, you need to include it *inside* the
while loop, at the moment it will only trigger after the while loop has
exited.
Rgds
Denis McMahon