<html>
<head>
<script>
function fib(number) {
var loop = [0, 1];
for (var i = 2; i < number; i++) {
loop[i] = loop[i-1]+ loop[i-2];
return loop[number-1];
}
document.getElementById("output").innerHTML
}
</script>
</head>
<body>
<input type text="text" id="txtloop" />
<input type="button" id="btnEnter" value="Enter" onclick="fib(txtloop.value)" />
<p id="output"></p>
</body>
</html>