# fibonacci code for javascript

Page 1 of 1

## 1 Replies - 14191 Views - Last Post: 01 February 2007 - 09:46 PM

### #1 chancecamby

Reputation: 0
• Posts: 1
• Joined: 01-February 07

# fibonacci code for javascript

Posted 01 February 2007 - 09:44 PM

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<title>Fibonacci Numbers</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language ="javascript">
<!--
// function to generate fibonacci numbers

function clear_Textbox() {
document.frmInputs.txtQuantity.value = "";
}
function generateNumbers(){

var s=0;
if (n==0) return (s)
if (n==1) {s=s+1;return (s);}
else{
return(f(n-1) + f(n-2));}
}{
var s='';
var n=10;
var n=n+1;
var k=n;
do
{var i=k-n;s=s+' '+f(i)}
while (--n);
}
//-->
</script>
<body>
<table>
<tr><td><img src="fibonacci.gif"></td>
<td><h3>Generating Fibonacci Numbers</h3></td></tr>
</table>
<form name="frmInputs">
<table>
<tr><td>How Many:</td><td><input type="text" style="WIDTH: 59px; HEIGHT: 22px" size=4 name="txtQuantity"></td>
<td><input type="button" value="Generate" onclick="function generateNumbers()"></td></tr>
</table>

</form>
</body>
</html>
My assignment is to create a code to calculate the fibonacci sequence of numbers always starting at 0 then based off of the number inputed like if you type 10 it gives you the sequence from 0 then up ten numbers in the sequence , then it must be displayed in an alert , after you click ok the cursor should go back to the input field ......i've spent three days on this and just can't get it THANK YOU for any and all help; It says line 27 char 13 object expected then line 53 char 1 { expected which is way way way out of place ,,,nothing works right now

This post has been edited by chancecamby: 01 February 2007 - 09:58 PM

Is This A Good Question/Topic? 0

## Replies To: fibonacci code for javascript

### #2 William_Wilson

• lost in compilation

Reputation: 207
• Posts: 4,812
• Joined: 23-December 05

## Re: fibonacci code for javascript

Posted 01 February 2007 - 09:46 PM