I used this function:

Code:

Math.factorial = function(n)
{
if(typeof n == 'string') n = Number(n);
if(typeof n != 'number' || isNaN(n))
{
alert("Factorial requires a numeric argument.");
return null;
}
if (n < 2) return 1;
return (n * Math.factorial(n-1));
}

and this to test it:

HTML Code:

<form action="">
<p><input type="text" name="T1" size="6">
<input type="button" value="Factorial"
onclick="T2.value = Math.factorial(T1.value); return true;">
= <input type="text" name="T2" size="12" readonly></p>
</form>

Otherwise, as pointed out, the syntax here is incorrect:

Code:

z = (factorial x / factorial (x-y));