Getting the value of a variable on the opener page from a popup window

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.

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.

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.