Click to See Complete Forum and Search --> : URGENT! PLEASE HELP: Change main web page from popup?


gangelo
January 31st, 2006, 11:46 AM
Hi,:confused:

My main web page creates the below popup. I want to click a link in my popup and have my main web page go to the url. I do not care if the popup remains open at that point or not (I'd rather it close actually).

How do I do this?


<map name="Map">
<area shape="rect" onmouseover="ChangeCursor();" onmouseout="ChangeCursorBack();" coords="295, 72, 445, 95" target="_blank" style="cursor:hand" onclick="var myWindow = window.open('Flash/treeredone.asp','ORGCHART','height=600,width=800,top=0,left=0,scrollbars=no');">
</map>

Dr. Script
January 31st, 2006, 02:56 PM
Your pop-up's target would simply have to point to the opener. That isn't enough code for me to see what you are doing .. is that opening the pop-up, or is that code on the pop-up ... please explain.

gangelo
February 1st, 2006, 08:16 AM
Hello, thank you for your reply.

The code in the snippet is in the opener. In other words, the code in the snippet opens the popup.

What would the code in the popup look like to change the opener's page ?

degsy
February 1st, 2006, 09:37 AM
Here is a basic version


<script type="text/javascript">
function winopen(){
win = window.open('','_blank');
win.document.open;
win.document.write('<a href="javascript:" onclick="opener.location=\'http://www.google.com\'">click</a>')
win.document.close();
}
</script>
<a href="javascript:" onclick="winopen()">click</a>

amitvb
February 7th, 2006, 09:20 AM
U can access the main page's elements from the popup by
simply replacing 'document.something' in main page's JS with 'window.opener.document.something' in popup page's JS.

a sample code would look like
window.opener.projForm.search2.value="done";

I hope this is the relevant answer