Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy code doesnt work in firefox

    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:

    Code:
    <script language="JavaScript" type="text/javascript">
    window.name = "main";
    </script>
    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):

    Code:
    <script language="JavaScript" type="text/JavaScript">
    function reloadMainPage ()
    {
    		window.opener.location.reload(false);
    		window.close();
    }	
    </script>
    <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>
    </div>
    now in IE everythign works fine, in FireFox the "View Cart" doesn't, zooming on to that snippet:

    Code:
    <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.

  • #2
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, erm, i found a fix for this, mods, please lock this thread
    sorry if this considered threadwaste


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •