Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a Function from a different page

Status
Not open for further replies.

szgr

Programmer
Nov 7, 2001
4
0
0
GB
I am attempting to call a function that operates in a page from a window that sits on top and operates like a remote control. I am unsure on the syntax of how to call the function from remote control to then operate on the main page. I have several href links already on the remote control, but they open pages as opposed to functions within a given page. Any help would be much appreciated.

 
If the function is in the parent, or main browser window and you want to call it from the sub window you would do it like this.
Code:
self.opener.
functionname()

If the function is in the sub window and you want to call it from the main window, you would first need to store the window object to a variable, then you can call the function by that variable reference to the sub window. Here's an example.
Code:
var mySubWin
function openWin() {
  mySubWin = window.open(...);
}
function runFuncInSubWin() {
  if(mySubWin && !mySubWin.Closed) {
    mySubWin.
functionname()
Code:
  }

}

ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top