程序代码:
<div id="show"><hr/><script>
// 累加结果
function Fib3(num) {
var a,b,c,i,c=num,num=num/2;
for(a=b=i=1;i<num;i++)
a += b,b+= a;
return c%2?a:b;
}
var show = document.getElementById("show");
for(var i=0;i<20;i++){
show.innerHTML += Fib3( i) +",";
}
</script>