I can't get the result to display on the html page, which is why i have it as an alert 

```
<h1>Factorial Problem</h1>
<form name="frm1">
Enter any number :<input type="text" name="fact1"><br><br>
<input type="submit" value="Calculate" onclick="fact(frm1.fact1.value)">

```

here is the JavaScript

```
function fact(n){
    var m=1;
    while(n){
         m=m*n;
         n--;
    }
    alert("Factorial of given number :"+" "+ m);
}

```