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, 08: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, 09:53 AM #2
- Join Date
- Dec 2010
- Thanked 558 Times in 551 Posts
var name1frame = document.getElementsByName('name1').contentWindow; name1frame.fun1();
01-19-2012, 08:11 PM #3
Or slightly simpler
var name1frame = document.frames["name1"].contentWindow;
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.