Click to See Complete Forum and Search --> : help with a pop up


Trinian
10-29-2003, 06:30 PM
hi everyone

I have created a popup that displays a product I wish to display as a monthly special. This popup pops up when the user loads the page. That is the easy part, I can do that.

What I am having problems with is I want the user to be able to select "Buy Now" or "No Thanks" buttons. If the user selects "no thanks" I just close the window and they are back at the home page. If the user selects "Buy Now" the popup closes and the order page opens in the main window. This is were I am stuck... :(

I have been trying to create a function with "window.opener.document.action = "URL OF ORDER PAGE"+Productcode

and then a <a href="javascript:functionname(productcode-eg5454);" but with no luck.

If anyone could help me with this that would be great.

Thanks Heaps

Trinian.

Charles
10-29-2003, 06:52 PM
<a href="product.pl?product-code=eg5454" onclick="if (window.opener && !window.opener.closed) {window.opener.location = this.href; return false}">Buy Now</a>

Trinian
10-29-2003, 07:11 PM
:D thats great thanks heaps. It is now taking me to the order page. but it still doesnt close the popup window. Any idea on how to do that as well.

Thanks heaps for that code. I was way off :)

Trinian

Trinian
10-29-2003, 07:43 PM
dont worry bout it. I got it to work :)

thanks heaps for the code. saved my life :)

Trinian

Trinian
10-29-2003, 10:35 PM
ok some more help with another popup :)

I am using this code to popup information
"<a href="" onClick="MyWindow=window.open('http://www.petalsflorists.com/popup/customer.htm','Window1','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,r esizable=no,width=500,height=430,left=20,top=20'); return false;">"

the problem I have is the if you click the popup once and then go back to the main page with out closing the window and then try to click it again it doesnt show up :(

I thought of using window.focus() but am not sure how to implement it into this code.

thanks again

trinian

Charles
10-30-2003, 04:13 AM
You have to give your "href" attribute a real value for the teeming millions who do not use JavaScript or have disabled popups.

<a href="http://www.petalsflorists.com/popup/customer.htm" onclick="myWindow=window.open(this.href, 'Window1', 'scrollbars,resizable,width=500,height=430,left=20,top=20'); myWindow.focus(); return false">