PDA

View Full Version : Pop Up Window



jnscollier
03-31-2007, 08:22 PM
So, I have a pop up window that pops up user profiles on my site, my question is... Is there a way to have a link on the pop up window that closes the pop up window and passes the link to the main browser??

Let me try to clarify, let's say if I'm on the site and I click on Suzie to check out her profile, a pop up window appears with her information. At the bottom of her profile she might have a link to her myspace page for example. Is there a way so when I click that link that the pop up window closes and it opens the myspace page in the main browser INSTEAD of opening the myspace page in the pop up window??

:eek:

thetestingsite
03-31-2007, 08:49 PM
Place this in the head of the document that the pop up window displays:



<script type="text/javascript">

function LoadandClose(url) {
if (window.opener && !window.opener.closed) {

window.opener.location.href= url;
window.close();
}
}
</script>


Then place the this link where ever you want it at (edit the part in red):



<a href="http://www.domain.com" onclick="LoadandClose(this.href); return false;">Link Name Here</a>


Hope this helps.

jnscollier
03-31-2007, 09:05 PM
It closes the window, which is excellent!! But, it goes to www.StupidPeoplepissmeoff.com/ (whatever their link is)... How can I have it just go to the link?

Thanks!!

thetestingsite
04-01-2007, 02:08 AM
Are you calling the link like this:



www.domain.com


or with the http:// in front of it. This script will not function properly unless you use the http:// part.

Hope this helps.