<HTML> <HEAD> <TITLE>......</TITLE> <HEAD> <SCRIPT> function displayNx (number, factor) { window.document.open() window.document.writeln("<TABLE BORDER=2>"); for (var i=1; i<number; i++) { window.document.writeln ("<TR><TD>",i,",factor," = </TD><TD>",factor*i,"</TD></TR>") } window.document.writeln("</TABLE>"); window.document.close() } </SCRIPT> <BODY> yyyy<BR> <-- html <CENTER> <-- html xxxx<BR> <-- html xxxx<BR> xxxx<BR> <SCRIPT> displayNx (15, 25) </SCRIPT> xxxx<BR> xxxx<BR> <-- html xxxx<BR> <-- html </CENTER> <-- html yyyy<BR> <-- html </BODY> </HTML>
You see that if 15 is programmed as factor (=15), and if 25 is programmed as number (=25), the table produces 14 rows of calculations.
Remark 2: In normal scripts 'writeln' is seldom used. Programmers prefer fields for output.
Enschede, 20 jan. 2000; updated jan. 28, 2003