The function below (as fc.js) works with IE6.0, NS4.2 NS7.1. It
rewrites itself increasing the number.
However if I comment out the othervise unnecessary window.alert, it
still works with NS but falls into and endless loop in IE. The alert
helps only after the scr=fc.js line, otherwise the first recursion
causes the endless loop in IE
Any cue for the reason or more preferably workaround is appreciated. I
include the text for fc.js and the calling test.html
laszlo
***** fc.js *****
function testrut(cnt) {
var teststr = "Hello";
var nwf = window.open("", "testecske", "width=200,height=200");
cnt++;
nwf.document.writeln("<HTML><HEAD>");
nwf.document.writeln("<TITLE>recursive javascript</TITLE></HEAD>");
nwf.document.writeln("<BODY BGCOLOR=silver ><FORM><CENTER>");
nwf.document.writeln(teststr + cnt + "<BR><BR>");
nwf.document.writeln("<INPUT TYPE=BUTTON VALUE=repeat
onclick='testrut(" + cnt + ");'><BR><BR>");
nwf.document.writeln("<INPUT TYPE=BUTTON VALUE=close
onclick='window.close();'><BR><BR>");
nwf.document.writeln("</CENTER></FORM>");
nwf.document.writeln("<SCRIPT LANGUAGE='JavaScript1.2'
SRC='fc.js'></SCRIPT>");
nwf.document.writeln("</BODY></HTML>");
window.alert('hohoho');
nwf.document.close();
}
***** test.html *****
<HTML><HEAD>
<SCRIPT LANGUAGE='JavaScript1.2' SRC='fc.js'></SCRIPT>
<TITLE>Test</TITLE></HEAD>
<BODY><FORM><CENTER>
<INPUT TYPE=BUTTON VALUE=start onclick=testrut(0);>
</CENTER></BODY></HTML>