title: factorial of a number
body: <p>I have the following code but it is not giving perfect result for factorial can u find it out plz</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
   &lt;head&gt;
    &lt;title&gt; New Document &lt;/title&gt;
    &lt;script type="text/javascript"&gt;
   function fact(num)
   {
      var x=parseInt(num);
      //alert(x+1);
      if(x&gt;0)
          x=x* fact(x-1);
      alert(x);
   }
    &lt;/script&gt;
   &lt;/head&gt;
  
   &lt;body&gt;
   &lt;form name="f1"&gt;
    Enter the Number  :&lt;input type="text" length="8" name="txt1"&gt;&lt;br&gt;
    &lt;input type="button" value="Find factiorial" onclick="fact(txt1.value)"&gt;
    &lt;/form&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>