Program:
Frameset.html :
Accept.html:
Print.html :
Output:
Frameset.html :
<html> <frameset cols="40%,60%"> <frame src="./accept.html" name="p1" frameborder="1"></frame> <frame src="./print.html" name="p2" frameborder="1"></frame> </frameset> <!-- <body> <iframe src="./accept.html" name="p1" frameborder="1" ></iframe> <iframe src="./print.html" name="p2" frameborder="1" ></iframe> </body> --> </html>
Accept.html:
<html> <head> <title>Accept</title> </head> <body> <form name="f1"> Enter any Number: <input type="text" name="t1"><br> <input type="button" value="calculate" name="b1" onclick="parent.p2.fibo()" > </form> </body> </html>
Print.html :
<html> <head> <title>Print</title> <script> function fibo() { var n = parent.p1.f1.t1.value; var f1 = 0, f2 = 1; var f3 = 0; var arr = new Array(); for (var i = 1; i <= n; i++) { f1 = f2; f2 = f3; arr.push(f3); f3 = f1 + f2; } document.getElementById("id").innerHTML = "Fibonacci Series: " + arr; } var looping = function (n) { var a = 0, b = 1, f = 1; for (var i = 2; i <= n; i++) { f = a + b; a = b; b = f; } return f; }; </script> </head> <body> <p id="id"> </p> </body> </html>
Output: