Find Factorial of Number using JavaScript

Factorial calculator script allows you to find factorial of given number using JavaScript.


  • Factorial script is used for all factorial calculations.
  • Find factorial of any number, using this calculator script.
  • We can handle this script easily and it works in all major browsers.


Enter Value    


Click select code button to copy factorial number script. Javascript Code

<!--Script by>
<!--Copyright of>
<!-- Free javascripts @ -->
<title>Factorial Number Calculator Script</title>
<script type="text/javascript" src=""></script>
<style type='text/css'>
background: white;
border: 1px solid #DDD;
border-radius: 5px;
box-shadow: 0 0 5px #DDD inset;
color: #666;
float: left;
padding: 5px 10px;
width: 250px;
height: 40px;
outline: none;
text-align: center;
font-size: 15px;
cursor: pointer;
width: 100px;
height: 40px;
color: #4e4e4e;
<script type='text/javascript'>
var factorial = 1;
function getfact()
var sds = document.getElementById("dum");
if(sds == null)
alert("You are using a free package.\n You are not allowed to remove the tag.\n");
var sdss = document.getElementById("dumdiv");
if(sdss == null){
alert("You are using a free package.\n You are not allowed to remove the tag.\n");
if(sdss != null)
var value = $("#factval").val();
var num = isNaN(value);
$("#factval1").html("Enter the value");
setTimeout(function() {
}, 3000);
$("#factval1").html("Entered value exceeds limit");
setTimeout(function() {
}, 3000);
for (var x=value; x>=1; x--)
factorial = factorial * x;
$("#dispans").html("The Factorial of '"+value+"' is : <span style='color:#900B09;font-size: 18px;'>"+factorial+"</span>");
function isNumberKey(id)
var no=eval('"'+id+'"');
var no1=eval('"'+id+'1"');
var number= document.getElementById(no).value;
var number1= document.getElementById(no1);
if(!number.match(/^[0-9]+$/) && number !="")
number1.innerHTML="<font color='red'>Enter numbers only</font>";
setTimeout(function() {
$("#factval1").html("");}, 3000);
}function resetval(){
<body><div align='center'>
<div align='center' style='color: #4e4e4e; font-size: 20px; padding-top: 50px;'>Factorial Number Calculator Script</div><br>
<span id='factval1' style='color:red;font-size:15px;font-family:arial,verdana,san-serif;'></span><br><br><table align='center'>
<tr><td style='font-family: arial,verdana,san-serif;font-size: 15px;color:#666;'>Enter Value : </td>
<td><input type='text' id='factval' class='tb7' maxlength='3' onkeyup="isNumberKey(" /> </td>
<td> <input type='button' onclick='getfact()' value='Get Factorial' class='testbutton'>  <input type='button' onclick='resetval()' value='Reset' class='testbutton'> </td>
</table><br><div id='dispans' style='color: #2f4f4f;margin-top: 5px;'></div><br>
<div align=center style=" font-size: 10px;color: green;" id="dumdiv">
<a href="" id="dum" style="padding-right:0px; text-decoration:none;color: green;">©h</a></div></div>

  • Release Date - 28-11-2013
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to


  • Copy paste the factorial number calculator script in your webpage.
  • Now run the file in your browser to view the functionality of the script.


Related Scripts

Free Javascript Scripts

Ask Questions

Ask Question