Popup window code doesn't work

Discussion in 'Javascript' started by Mika, Jul 5, 2003.

  1. Mika

    Mika Guest

    Hi,

    I'm trying to use the following code which should open a popup window.
    It doesn't work with Opera 5. Netscape 4.x opens a window in wrong size.
    IE 5.5, Netscape 7.0 and Opera 7.11 are ok.

    First of all, I have this HTML code:

    <a href="image.gif" target="_blank" onclick="screenshot('image.gif', 'My
    Title', '741', '492'); return false;"><img src="image.jpg"></a>

    Plese note that the size of image.gif is 741 x 492 pixels.

    And here is my JavaScript function:

    function screenshot(filename, wintitle, winwidth, winheight)
    {
    content = '<html><head><title>' + wintitle + '</title></head>';
    content += '<body leftmargin="0" rightmargin="0" topmargin="0"
    bottommargin="0" marginwidth="0" marginheight="0" style="margin: 0px;
    padding: 0px">';
    content += '<img src="' + filename + '" alt="' + wintitle + '"
    onclick="window.close();">';
    content += '</body></html>';

    body = window.open('', 'content', 'toolbar=0, menubar=0, location=0,
    status=0, width=' + winwidth + ', height=' + winheight + ', resizable=1,
    scrollbars=0, screenY=5, top=5');
    body.document.write(content);
    body.document.close();
    }

    What should I do with these?

    Thanks a lot,
    Mika
    Mika, Jul 5, 2003
    #1
    1. Advertising

  2. Mika

    Evertjan. Guest

    Mika wrote on 05 jul 2003 in comp.lang.javascript:
    > body.document.write


    document.body.write ??

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Jul 5, 2003
    #2
    1. Advertising

  3. Mika wrote:
    > Hi,
    >
    > body = window.open('', 'content', 'toolbar=0, menubar=0, location=0,
    > status=0, width=' + winwidth + ', height=' + winheight + ', resizable=1,
    > scrollbars=0, screenY=5, top=5');


    Remove the spaces between the parameters in the window attributes (a.k.a.
    "chroma") section. NS4 and other browsers will fail if this area has spaces.
    Good luck!

    Richard L. Trethewey
    Richard L. Trethewey, Jul 6, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jay
    Replies:
    8
    Views:
    6,538
    livshitz
    Jun 12, 2011
  2. =?Utf-8?B?Sm9obiBXYWxrZXI=?=

    Popup Window Popup Timing

    =?Utf-8?B?Sm9obiBXYWxrZXI=?=, Nov 4, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    830
    =?Utf-8?B?Sm9obiBXYWxrZXI=?=
    Nov 4, 2005
  3. spoofie
    Replies:
    0
    Views:
    366
    spoofie
    May 16, 2008
  4. Jens Peter Hansen
    Replies:
    7
    Views:
    499
    Randy Webb
    Jun 19, 2004
  5. Raffi
    Replies:
    4
    Views:
    202
    Dr John Stockton
    Aug 12, 2004
Loading...

Share This Page