Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: call function of another page
01-19-2012, 09:21 AM #1
- Join Date
- Jan 2012
- Thanked 0 Times in 0 Posts
call function of another page
<frame src="page1.html" name="name1" frameborder="0"></frame>
<frame src="page2.html" name="name2" frameborder="0"></frame>
as both are separate frame both have there own copy function
I call fun2() from page2.html and inside that function I want to call page1.html's fun1().
fun1() in page1.html and fun1() in page2.html both return different result because of there global variables.
Is there any way to call fun1()-page1.html from the fun2()-page2.html?
01-19-2012, 10:53 AM #2
- Join Date
- Dec 2010
- Thanked 570 Times in 563 Posts
Code:var name1frame = document.getElementsByName('name1').contentWindow; name1frame.fun1();
01-19-2012, 09:11 PM #3
Or slightly simpler
But personally, I always just give id's to my frames, instead of or in addition to the names, and then useCode:var name1frame = document.frames["name1"].contentWindow;
Code:var frame1window = document.getElementById("frame1").contentWindow;
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.