www.webdeveloper.com
Results 1 to 3 of 3

Thread: call function of another page

Hybrid View

  1. #1
    Join Date
    Jan 2012
    Posts
    2

    call function of another page

    <frameset rows="30%,70%>
    <frame src="page1.html" name="name1" frameborder="0"></frame>
    <frame src="page2.html" name="name2" frameborder="0"></frame>
    </frameset>

    in above code I used page1.html & page2.html as frame. Both include same javascript file having two function name fun1() & fun2().

    as both are separate frame both have there own copy function

    page1.html
    fun1()
    fun2()
    page2.html
    fun1()
    fun2()

    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?

  2. #2
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,264
    You can call global functions defined in frame name1, from javascript in frame name2 with top.name1.fun1() (See window.top). They are not "global functions", they are methods of the window object for frame name1.

  3. #3
    Join Date
    Jan 2012
    Posts
    2

    Thumbs up solved

    Quote Originally Posted by 007Julien View Post
    You can call global functions defined in frame name1, from javascript in frame name2 with top.name1.fun1() (See window.top). They are not "global functions", they are methods of the window object for frame name1.
    Thanks... It solve my problem

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles