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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup window each has own size

    Hi, i am having a problem with javascript. I have a page with a bunch of links on it, and whenever someone clicks on link i want it to popup, but each popup to have its own size, instead of a fixed size.
    Im not sure where to start or what to change, please help.

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function Help(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=300,left = 290,top = 100');");
    }
    // End -->
    </script>
    ?>
    
    <a href="JavaScript:Help('link.php');">Link</a>

  • #2
    Regular Coder
    Join Date
    Nov 2004
    Location
    The land of chocolate
    Posts
    226
    Thanks
    1
    Thanked 16 Times in 16 Posts
    Can't you pass the desired width and height of the popup along with the url as parameters to the function?

    So the function would be "Help(URL,width,height)" and the popup code adjusted according to that?
    -Snow

    Susie, if you want to see your doll again, leave $100 in this envelope by the tree out front. Do NOT call the police. You CANNOT trace us. You CANNOT find us.

    Sincerely,
    - Calvin.

  • #3
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, but no it didn't work.

    Code:
    <a href="JavaScript:Help('index.php,500,50');">Link</a>
    and wasnt sure how to properly edit the popup script.


    EDIT: Thanks anyways, but tried this (see next line) and it worked without having to use a separate script:
    Code:
    <A HREF="javascript:void(0)" onclick="window.open('welcome.html','welcome','width=400,height=300')">Link</A>
    Last edited by DreamHack497; 02-11-2009 at 01:40 AM.

  • #4
    Regular Coder
    Join Date
    Nov 2004
    Location
    The land of chocolate
    Posts
    226
    Thanks
    1
    Thanked 16 Times in 16 Posts
    If you don't need other code to be executed, only the popup window, yes, that works.

    For future reference, if you want to pass more parameters to a function, do it the following way:
    Code:
    <a href="javascript:Help('index.php','500','50');">Link</a>
    -Snow

    Susie, if you want to see your doll again, leave $100 in this envelope by the tree out front. Do NOT call the police. You CANNOT trace us. You CANNOT find us.

    Sincerely,
    - Calvin.


  •  

    Posting Permissions

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