View Full Version : code doesnt work in firefox

07-17-2004, 07:25 AM
with my little knowlege of JavaScript of today, i have coded the following. its has been added via PHP on a website i am co-creating and for some reason part of the code is not working at all in Firefox (and i am guessing any other Mozilla browser). the following is the explanation and the code.

what i wanted to do was make a pop-up when a picture in the album is clicked. the code is beefed up with php to display full preview of the clicked picture from an album page. so basically, we click an image link to open a pop-up with content. that part works. the opener/parent also has this code in head:

<script language="JavaScript" type="text/javascript">
window.name = "main";

You will see the point of it later. Now in the pop-up, if you click "order print" (button), PHP will process some code to add the item to cart and then will spit out this "finished page" that has 3 links: one return to the image's preview, one to close the window (and refresh the main window so that they can see that the cart has been updated), and one to open the cart in the main/parent window and close the pop-up. here is that code (local JS, php spits out the same):

<script language="JavaScript" type="text/JavaScript">
function reloadMainPage ()
<div align="center">
The photo has been added to the cart.<br/>
<a href="http://tcp.neoturbine.net:8000/portfolio/viewCart.php" target="main" onClick="window.close()">View Cart</a><br/>
<a href="#" onClick="history.go(-1)">Go Back to Photo Preview</a><br/>
<a href="" onClick="javascript:reloadMainPage();">Close window</a>

now in IE everythign works fine, in FireFox the "View Cart" doesn't, zooming on to that snippet:

<a href="http://tcp.neoturbine.net:8000/portfolio/viewCart.php" target="main" onClick="window.close()">View Cart</a><br/>

if i remove the onClick="window.close()", then the code works fine exepct for closing the link in FireFox, so i am guessing the code just closes the link without executing the rest of it. i was wondering i can write that link along with the target="main" to a function and just link like that or go on some other way around this to make it work.

07-18-2004, 06:16 AM
ok, erm, i found a fix for this, mods, please lock this thread
sorry if this considered threadwaste