<!DOCTYPE html>
<html>
<head>
<title>Ambiente Web</title>
<script type="text/javascript">
function fibo(num) {
var f = [];
for (var c = 0; c < num; c++) {
f.push((c < 2) ? c : f[c-1] + f[c-2]);
}
return f;
}
var aux=document.getElementById('Largo').value;
document.getElementById("textarea").innerHTML = fibo(aux);
</script>
</head>
<body>
<input type="text" value="" id="Largo" name="largo del arreglo"></input>
<input type="button" value="Calcular" onclick="fibo();"></input>
<textarea id="textarea" readonly rows="5" cols="10"></textarea>
</body>
</html>
So the thing is that i am calculating the fibonacci sequence, the function by itself works perfect, but i want someone to put the lenght of the fibonacci sequence in the input type="text" and pass it to the fibo parameters and then the result send it to the textarea but it should work and i dont know what happens. Also i dont know how to make the script only run when clicking de "calcular" button with the onlick.