wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Calling a function from another window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Calling a function from another window" Watch "Calling a function from another window" New topic

Calling a function from another window

Jos� Miguel Velasco

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

Joined: Nov 08, 2001
Posts: 15376
you can call a function from the child window by adding the window.opener object to it.


You can reload the page with


Jos� Miguel Velasco

Joined: Dec 17, 2004
Posts: 2
Thanks. It works.
Consider Paul's rocket mass heater.
subject: Calling a function from another window
Similar Threads
Using form:select data on same page
Identifying events with javascript functions registered
Using dropdown box in JavaScript
Urgent:: How to get values into a combo-box dynamically.......
Databases and jsp