Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing the popup window

Status
Not open for further replies.

noyes99

Programmer
Jun 25, 2002
38
IN
Hi everyone,

I have created a popup that has an image map in it, and I need to close that popup when someone clicks on a link, and redirect the parent window to the link. I have written some code that works fine on IE, but doesn't work on Netscape and Mac. Could someone help me debugging it?

Thanks

Here's the code
:
#####################################
to open the window
#####################################

<script language=&quot;JavaScript&quot;>
function popSize(winURL,winName) {

// assign values to window height, width, and coordinate vars
var popWidth =435;
var popHeight = 255; // default for users with smaller screens



var popLeft = (screen.availWidth / 2) - (popWidth / 2);
var popTop = (screen.availHeight / 2) - (popHeight / 2);

// assemble list of window features
var winFeat = &quot;directories=no,location=no,menubar=no,personalbar=no,resizable=no,scrollbars=no,status=no,toolbar=no,&quot;;
winFeat += &quot;width=&quot; + popWidth + &quot;,&quot;;
winFeat += &quot;height=&quot; + popHeight + &quot;,&quot;;
winFeat += &quot;left=&quot; + popLeft + &quot;,&quot;;
winFeat += &quot;top=&quot; + popTop;

// open the new window
window.open(winURL,winName,winFeat);
}
</script>


<script language=&quot;javascript&quot;>
popSize('/popup_8/1,2836,,00.html','POP');
</script>


###########################
to close the window :
############################
<area shape=&quot;rect&quot; alt=&quot;&quot; coords=&quot;15,12,130,162&quot; href=&quot;javascript:window.opener.location('/popup_redirect?navsource=issue');self.close();&quot;>


##################################


as i said, this works fine on IE, but doesn't work on Netscape or MAC

 
Change:

href=&quot;javascript:window.opener.location('/popup_redirect?navsource=issue');self.close();&quot;>

To:

href=&quot;javascript:window.opener.location=';self.close();&quot;>

* Get rid of the () and use the equal sign, url must be a qualified path.


MrGreed

&quot;did you just say Minkey?, yes that's what I said.&quot;
 
thank you. it worked. I did not have to remove the '=' sign though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top