<HTML> <HEAD> <TITLE>......</TITLE> <HEAD> <SCRIPT> function fac (n) { var y; if ((n==0) || (n==1)) return 1 else { y=( n*fac(n-1) ); return y } } function facAltn(n) { var y,j; y=n; for (j=n-1; j>1; j--) y=y*j; return y } function facultA (form) { var z; i=document.form8.p1.value; document.form11.p.value = fac (i); } function facultB (form) { var z; i = document.form8.p1.value; document.form11.q.value = facAltn (i); } function function11 (form) { document.form11.r.value = fac (document.form8.p1.value); } function function12 (form) { var z; i = document.form8.p1.value; with (Math) document.form11.s.value = sin (i); } </SCRIPT> <BODY> xxxx<BR> xxxx<BR> xxxx<BR> <FORM NAME="form8"> <INPUT TYPE="TEXT" NAME="p1" VALUE="29" SIZE="10"> </FORM> xxxx<BR> xxxx<BR> <FORM NAME="form11"> <INPUT TYPE="button" VALUE="facult A" ONCLICK="facultA (this.form)"> <INPUT TYPE="TEXT" NAME="p" VALUE="aaa" SIZE="30"> <BR> <INPUT TYPE="button" VALUE="facult B" ONCLICK="facultB (this.form)"> <INPUT TYPE="TEXT" NAME="q" VALUE="bbb" SIZE="30"> <BR> <INPUT TYPE="button" VALUE="facult C" ONCLICK="function11 (this.form)"> <INPUT TYPE="TEXT" NAME="r" VALUE="ccc" SIZE="30"> <BR> <INPUT TYPE="button" VALUE="sinus" ONCLICK="function12 (this.form)"> <INPUT TYPE="TEXT" NAME="s" VALUE="ddd" SIZE="30"> </FORM> xxxx<BR> xxxx<BR> xxxx<BR> </BODY> </HTML>
The function 'function11' and 'facultA' needs the function 'fac'. The function 'facultB' needs 'facAltn'. We call them 'nested fuctions'.
If you see numbers as 1.1240007277776077e+21 than you have to know that that is 1.124 x 10 21. We call that the e-way of notation of a broken value.
Enschede, 9 januari 2001