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 Coder
    Join Date
    Oct 2003
    Posts
    46
    Thanks
    6
    Thanked 0 Times in 0 Posts

    JavaScript Pop-Up Window Help

    I'm using the script for a JavaScript pop-up window from the following site, http://wsabstract.com/popwin/index.shtml
    Trouble is, when I have the code several times on one page linking to different sites, they all display the same site when I click the link even through the target page is different.
    In this case, all links show 'reviews3.html'
    The whole code is below, I would appreciate your help.

    http://www.evolved-games.com/litr2/reviews.html

    <html>
    <!-- Created with the CoffeeCup HTML Editor -->
    <!-- http://www.coffeecup.com/ -->
    <!-- Brewed on 01/02/2003 23:15:14 -->
    <head>
    <title></title>
    <meta http-equiv="Page-Exit" content="blendTrans(Duration=1)">
    </head>
    <body bgcolor="#6979E8">

    <p><center><font face="Verdana" size="1"><u>Reviews</u>
    <p><script>
    function openpopup(){
    var popurl="reviews1.html"
    winpops=window.open(popurl,"","width=400,height=338,scrollbars,menubar,")
    }

    </script>

    <a href="javascript:openpopup()">Waxing Captors Reviews</a></b>
    </script>
    <p><script>
    function openpopup(){
    var popurl="reviews2.html"
    winpops=window.open(popurl,"","width=400,height=338,scrollbars,menubar,")
    }

    </script>

    <a href="javascript:openpopup()">Les Revoilou! Reviews</a></b>
    </script>
    <p><script>
    function openpopup(){
    var popurl="reviews3.html"
    winpops=window.open(popurl,"","width=400,height=338,scrollbars,menubar,")
    }

    </script>

    <a href="javascript:openpopup()">Live Revoilou! Reviews</a></b></script>
    </font>
    </body>
    </html>

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    It's wierd script.... there are 3 functions there with the same name... That is incorrect. You should either name them different, or use a single function and parse a parameter on event (with the variant of using directly this).

    Try this:

    in HEAD
    Code:
    <script>
    function openpopup(popurl){
    window.open(popurl,"","width=400,height=338,scrollbars,menubar,");
    }
    </script>
    now call the function in BODY

    Code:
    <a href="javascript:void(openpopup('reviews1.html');return true)">blabla1</a>
    <a href="javascript:void(openpopup('reviews2.html');return true)">blabla2</a>
    <a href="javascript:void(openpopup('reviews3.html');return true)">blabla3</a>
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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