Of course it puts the data output into a new window but will not size the window, even with correct height and width attributes. Any ideas, how I can do that in this simple cgi?
It's too late. You have to open a window for that target name on the client side, with Javascript, before opening the URL of the script in it. This means you have to do it in an "onclick" event. There are two ways: open a new window with this URL, or just open a window (with any URL) and use the "href" attribute for the URL.

I tend to use both at the same time, so that it still sort of works, if Javascript is disabled: it'll do the same thing you see now, then. By making the "onclick" event return false one can prevent the CGI script from being called twice.

We've navigated completely out of the realm of Perl now, and what remains is a pure HTML/Javascript problem. However, I would feel bad for stopping here, so I'll stick out my neck and give you some HTML/Javascript to play with:

<script language="JavaScript"><!-- function openBrowserWindow(theURL,winName,features) { var w = window.open(theURL,winName,features); w.focus(); } //--></script> <a href="scripturl.cgi" onClick="openBrowserWindow('scripturl.cgi','sc +ripttarget','width=400,height=300'); return false;" target="scripttar +get">results</a>
Note the redundancy in URL and window target name. One is for Javascript enabled, one for Javascript disabled browsers.

In reply to Re: Need to use Javascript function in Code by bart
in thread Need to use Javascript function in Code by mystiko

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.