[thelist] JS and CGI

Jeremy Ashcraft ashcraft at 13monkeys.com
Thu, 06 Jan 2000 22:32:58 -0600


--------------B7A6385461CE7C2633C3DE09
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

>
> >  > Greetings List,
> >  >
> >  > Am delving into some cgi stuff at present and was wondering if it was possible to use a JS
> >  > function like :
> >  > <script language="javascript>open.window('foo.htm','new',config='width=500,
> >  > height=400')</script>...but replace foo.htm with a sub routine.
> >

You might try window.open instead of  open.window, also I take it you want to have the contents returned from &admin show up in the new window, try something like this:

<perl script snippet>
...
print "<script language="javascript>\n";
print "var newWin = window.open('','new','width=500,  height=400');\n";

$output = &admin;

print "newWin.document.open();\n";
print "newWin.document.write('$output');\n";
print "newWin.document.close();\n";
print "<script>\n";
...
</perl script snippet>

what the above does is print out the javascript that opens a new empty window with no file specified.  It then calls &admin and &admin returns some type of text or something to the variable $output.    It then
print the javascript to open the document in the new window, print the contents of  $output into the new window, then close the document.    LMK if you have any questions.

--
Jeremy Ashcraft
web developer/geek
http://www.13monkeys.com



--------------B7A6385461CE7C2633C3DE09
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>

<blockquote TYPE=CITE>&nbsp;
<br>>&nbsp; > Greetings List,
<br>>&nbsp; >
<br>>&nbsp; > Am delving into some cgi stuff at present and was wondering
if it was possible to use a JS
<br>>&nbsp; > function like :
<br>>&nbsp; > &lt;script language="javascript>open.window('foo.htm','new',config='width=500,
<br>>&nbsp; > height=400')&lt;/script>...but replace foo.htm with a sub
routine.
<br>></blockquote>

<p><br>You might try window.open instead of&nbsp; open.window, also I take
it you want to have the contents returned from &amp;admin show up in the
new window, try something like this:
<p>&lt;perl script snippet>
<br>...
<br>print "&lt;script language="javascript>\n";
<br>print "var newWin = window.open('','new','width=500,&nbsp; height=400');\n";
<p>$output = &amp;admin;
<p>print "newWin.document.open();\n";
<br>print "newWin.document.write('$output');\n";
<br>print "newWin.document.close();\n";
<br>print "&lt;script>\n";
<br>...
<br>&lt;/perl script snippet>
<p>what the above does is print out the javascript that opens a new empty
window with no file specified.&nbsp; It then calls &amp;admin and &amp;admin
returns some type of text or something to the variable $output.&nbsp;&nbsp;&nbsp;
It then print the javascript to open the document in the new window, print
the contents of&nbsp; $output into the new window, then close the document.&nbsp;&nbsp;&nbsp;
LMK if you have any questions.
<pre>--&nbsp;
Jeremy Ashcraft
web developer/geek
<A HREF="http://www.13monkeys.com">http://www.13monkeys.com</A></pre>
&nbsp;</html>

--------------B7A6385461CE7C2633C3DE09--