<!doctype html>
<html>
<head>
<title>Calculate factorial of 5</TITLE>
</HEAD>
<body>
<h1> Calculate factorial of 5 </h1>
<form name="f1">
<input type="submit" value="Factorial of 5" onClick="display()">
</form>
</body>
<script language="Javascript">
function display()
{
var i,fact=1;
for(i=1;i<=5;i++)
{
fact=fact*i;
}
document.writeln("Factorial of 5 ="+fact);
}
</script>
</html>