in reply to Need to use Javascript function in Code

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.