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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Some popup problems!

    I've made a "members" page, where you can se info about different people. I've made it that way, when you click on a name an info box pops up with detailed infos.

    The problem is that they all link to the same link, though i have typed different url's and stuff.
    The source are available http://tsn.dk/p/?id=2466here

    Sorry if my english is bad, i aint good at it.
    And by the way, im a js-newbie...

    / SnooZeR

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Code:
    <html>
    <head>
    <script language="javascript">
    function openpopup(popurl)
    {
    winpops=window.open(popurl,"","width=500,height=500,toolbar,location,directories,status,menubar,")
    }
    </script>
    </head>
    <body>
    <a href="#" onclick="openpopup('infzheik.htm');">Open Me1</a>
    <a href="#" onclick="openpopup('infcbus.htm');">Open Me2</a>
    <a href="#" onclick="openpopup('infsnz.htm');">Open Me3</a>
    </body>
    </html>

    The whole purpose of a function is so you don't have to right the code over and over. Pass that which is changing through the function.

    Hope That Helps,
    Basscyst
    Last edited by Basscyst; 10-20-2003 at 12:22 AM.

  • #3
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks...
    though i still have one question, what shall i write instead of the "#" in this line: <a href="#" onclick="openpopup('infsnz.htm');">Open Me3</a>

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi SnooZeR ,

    You don't have to change it. That just tells the browser to void the link so that when you click on it it won't try to load something into the window rather it will just do the onClick. If you don't want to use the onClick you could also perform the function this way when you click on the link:

    <a href="javascript:openpopup('infzheik.htm');">Click Me1</a>

  • #5
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My site still keep telling me there is an error, so i have decided to upload det whole sourcecode with the JS-code Basscyst told me...

    You guys can see it here: http://tsn.dk/p/?id=2468

  • #6
    New Coder
    Join Date
    Jul 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    winpops=window.open(popurl,""," width=500,height=500,toolbar,location,directories,
    status,menubar,")
    Put this all into one line. That should solve the problem.

    Remember some people have javascript disabled on their browser, and the window may not open for them (not sure, haven't tested it yet). Change the # to the destination url, and add return false to the end of the onclicks. The page will open in the same window for those who disabled javascript.

    <a href="infzheik.htm" onclick="openpopup('infzheik.htm');return false">Open Me1</a>
    <a href="infcbus.htm" onclick="openpopup('infcbus.htm');return false">Open Me2</a>
    <a href="infsnz.htm" onclick="openpopup('infsnz.htm');return false">Open Me3</a>


  •  

    Posting Permissions

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