www.webdeveloper.com
Results 1 to 6 of 6

Thread: popup with different sizes on the same html?

  1. #1
    Join Date
    Nov 2002
    Posts
    2

    popup with different sizes on the same html?

    So, I have this script to open popup window with a specified size:


    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=800,height=600,left = 10,top = 10');");
    }
    // End -->
    </script>


    So this open a page of 800x600 but what if I also want another link (in the same html page) to open a different sized window...

    thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Content-Script-Type" content="text/javascript">
    <title>Window Example</title>
    <p><a href="http://www.w3.org/" onclick="window.open(this.href, '', 'height=400,width=300'); return false">The W3C</a></p>



    And see http://developer.netscape.com/docs/m...ow.htm#1202731 for more details.
    Last edited by Charles; 11-23-2002 at 10:40 AM.

  3. #3
    Join Date
    Nov 2002
    Posts
    421
    there must be more to your question than i am understanding. but . . . in your example you say you want another link to open another size window. then have the other link call another function (for example popUp2) with a different size window. you can have as many functions as you want. each link can point to a different function.

    if you are asking how to dynamically change that single window open function with different window sizes, then you would need to define a variable with the size you want and replace the actuial values in your statement with the variables.

    am i answering your question?

  4. #4
    Join Date
    Nov 2002
    Posts
    2
    Thanks Beach Bum,
    sorry if I wasn't clear enough, but you answered my question.
    I didn't know you could call a funcion popUp2, popUp3, etc.
    This really help.

    take care.

  5. #5
    Join Date
    Nov 2002
    Posts
    4,473

    Re: popup with different sizes on the same html?

    Originally posted by drtopo
    ...but what if I also want another link (in the same html page) to open a different sized window...
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function popUp(URL,wd,ht) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=' + wd + ',height=' + ht + ',left = 10,top = 10');");
    }
    // End -->
    </script>


    Call it like this:
    <a href="someURL.htm" onClick="popUp(this.href,800,600);return false">
    <a href="otherURL.htm" onClick="popUp(this.href,640,480);return false">


    One function, no waiting...

  6. #6
    Join Date
    Nov 2002
    Posts
    631
    The simplest way would be to make a new function that is exactly the same as the one you already have but has a different size.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles