Re: netscape infinate loop

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Fri, 12 May 2000 23:20:58 CDT
 To:  goomoo(at)hotmail.com
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
i can't find anything in the script that would cause netscape to hang, but 
there is an error:

the first argument in setTimeout is evaluated from the scope of the window, 
not the function, therefore direction is undefined. try this:

timer1 = setTimeout("move(\""+direction+"\")", 1);

have to add the quotes and then the value... if it still hangs, send the 
URL, it might not be in this snippet. also, you may not have to restart. if 
your running windows, press ctrl+alt+del and access the task manager and end 
task netscape. when you close the browser in this case, the application does 
not completely close, thats why its still messed up when you re-open. - 
Cyanide_7



>i seem to have created a small problem with netscape, the script below will
>stall out netscape, rendering it unusable until the computer is restarted.
>if anyone has any idea how this could have happened please let me know:
>
><SCRIPT LANGUAGE="JavaScript">
>
>function positionLayers() {
>
>	overviewObj = eval(document["overviewLyr"]);
>    overviewObj.top = 75;
>}
>var direction = "up";
>var timer1 = null;
>
>function move(dir) {
>    direction = dir;
>    var y_pos = parseInt(overviewObj.top);
>
>        if(direction == "dn" && y_pos > -100) {
>            overviewObj.top = (y_pos-2);
>
>            clearTimeout(timer1);
>            timer1 = setTimeout("move(direction)", 1);
>        } else if(direction == "up" && y_pos < 75) {
>            overviewObj.top = (y_pos+2);
>
>            clearTimeout(timer1);
>            timer1 = setTimeout("move(direction)", 1);
>        } else {
>            overviewObj.top = y_pos;
>        }
>}
></SCRIPT>
>
><body onload="positionLayers()">
>
>
>
>Sam =)
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA