| Author |
Calling a function from another window
|
Jos� Miguel Velasco
Greenhorn
Joined: Dec 17, 2004
Posts: 2
|
|
I'm trying to make something like this: I have an HTML page with Javascript. By clicking a button, another window is opened in order to allow data to be entered. I want this data to be updated in a data base (server side is PHP and MySQL), the secondary window be closed and the first window be refreshed with the new data. How can I call a Javascript function in the first window in order to reload it when the secondary window is closed? In the first window, a refreshing function is already coded and put as the onChange event of a SELECT element. It would be easy for me to simulate by code in the secondary window the SELECT's onChange event, but I'm afraid I can't. I'm able to get a reference in the secondary window to the SELECT element, but I have tried to execute the handleEvent method and it doesn't work. Anybody can give any idea? Thanks in advance.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
you can call a function from the child window by adding the window.opener object to it. window.opener.FUNCTION() You can reload the page with window.opener.reload(); Eric
|
 |
Jos� Miguel Velasco
Greenhorn
Joined: Dec 17, 2004
Posts: 2
|
|
|
Thanks. It works.
|
 |
 |
|
|
subject: Calling a function from another window
|
|
|