Javascript: change window opener location from popup
gwada
Status: New User - Welcome
Joined: 08 Aug 2005
Posts: 2
Reply Quote
Hi

i am launching a popup windows from a main html windows .
in the pop up windows i have a table with numbers , i will like when a number is double clicked to trigger the display of the page associated with that numbers on the main windows could someone give some help please

yan
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
That's pretty straighforward, the basic idea is simple, I'm not going to write your code for you, but this is roughly how it works:

Page 1 : js-o.htm
:: Code ::
<html>
<head>
</head>
<body>
<a href="#" onclick="window.open('js-c.htm','kid','resizable=no,scrollbars=no,width=250,height=148,toolbar=no');">click</a>
</body>
</html>

Page 2, the popup : js-c.htm
:: Code ::
<html>
<head>
</head>
<body>
<a href="#" onclick="window.opener.location.href='js-o2.htm';">change parent</a>
</body>
</html>

Page 3, the new parent page, js-o2.htm
:: Code ::
<html>
<head>
</head>
<body>
new page
</body>
</html>


Page 2 uses window.opener to write a new url to the location of the window opener. If you only wanted to change the content of the opener page, you'd use DHTML to change the content of an element of the page, pretty much the same syntax.

There's a pretty good discussion on this here.
Back to top
gwada
Status: New User - Welcome
Joined: 08 Aug 2005
Posts: 2
Reply Quote
Thanks.....it is working !!

yan
Back to top
Display posts from previous:   

All times are GMT - 8 Hours