Javascript Close Popup and Redirect Parent

This is my first time using my points so forgive if my question is lacking in information.

What I am trying to do is I have a popup window that opens in my shopping cart.  There are a list of links that the user can click on in this popup, but they all go to basically the same place (cart.php?partner=partnername).  What I need to have happen is when the user clicks the link that it loads that link in the parent page and closes the popup. I have it working in Firefox, but IE only closes the window and doesnt change the parent page. Additionally when the page does change/reload, the popup comes back because the page is still cart.php but just with different information after the ?

Here is the code I have to open the popup:
<script language="javascript">
window.name = "main";

function popUp(URL) {
day = new Date();
id = day.getTime();

eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=250,height=250,left = 200,top = 200');");
}
javascript:popUp('consultant_select.php')

</script>

This is one of the links that are in the popup window:
<a href="javascript:;" target="main" onClick="opener.location='http://www.mysite.com/store/cart.php?partner=joe_smith&bid=1';window.close();">

If you need more info please ask.  Also, if someone could tell me if the amount of points given is appropriate..I dont want to short anyone :-)
LVL 5
koolieAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

koolieAuthor Commented:
Just a quick update:  I can get the exact same "onClick" code to work if I put it in a button, which is kind of okay but I would much so prefer a link...So the more important of the two issues is getting that link to only popup once.  Thanks
0
dukestaTAICommented:
This page has a work around for MSIE.

http://jennifermadden.com/javascript/windowClose.html


Good luck,
0
dukestaTAICommented:
Here is a cleaner approach, and the full code, just cut, paste and try this one.

<html>
<head>
<script type="text/javascript">
function open_win()
{
window.open("http://www.w3schools.com");
this.focus();
self.opener = this;
self.close();
}
</script>
</head>

<body>
<form>
<input type=button value="Open Window" onclick="open_win()">
</form>
</body>

</html>
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

koolieAuthor Commented:
It's not as much an issue of getting the window to close.  I can get that done by using window.close().  What I cant get it to do is go to the new page and then close.  Thank you though...
0
dukestaTAICommented:
I don't understand, youwant to open a new window and then close it?
0
koolieAuthor Commented:
I like the cleaner code, but I have to have this page pop open onload.  My client is concerned that if I leave it up to a user to click a button, that they wont do it.  However, could this be put into an onload event in the body tag?
0
koolieAuthor Commented:
The window will popup from the cart page.  The links that are inside the popup contain values after the .php? that will say who gets commission for the sale.

So  cart.php loads -->popup opens -->user clicks who gets the commision -->popup closes --> cart.php loads the link that was clicked in the popup
0
dukestaTAICommented:
Have you tried this?

<a href="javascript:;" target="main" onClick="opener.location='http://www.mysite.com/store/cart.php?partner=joe_smith&bid=1';this.focus();self.opener = this;self.close();">
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
koolieAuthor Commented:
IE Still didnt like it....i dunno... The world would be a much better place if IE just floated away; however, I have managed to resolve my issue for the most part.  I still cant get to work with an <a> tag and in IE, but the buttons should be fine.  I only have 8 of them and buttons are a little more prominent anyway.  I appreciate the help and if you do by change figure it out please post it as I may need it later, but for the effort I'll throw the points u'r way...Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.