Getting the value of a variable on the opener page from a popup window
March 12, 2008
Javascript | Snippets

How do you use javascript to get the value of a variable on the opener page, from a popup window? Use "window.opener.variablename". This will work as long as the pages are in the same domain.

A working example can be seen here (click to view)

It consists of 2 pages. On the first page, a variable "timer" has been defined, and it automatically increments upward every 5 seconds. The current value is displayed in a div on the opener page.


Ads by Google

Posted by ellen at March 12, 2008 06:54 PM


Click the link that opens the popup page. Once opened, clicking a link on the popup page page starts up the function that repeatedly gets the current value of "timer" every 5 seconds. The values will be listed in a div on the popup page.


Download the files for both pages here (click to download)


Ads by Google


Ads by Google

 RSS   |   Contact Me


Ads by Google