HTML/CGI.pm question

Price, Erik eprice at ptc.com
Thu Nov 7 16:58:59 EST 2002


> -----Original Message-----
> From: pll at lanminds.com [mailto:pll at lanminds.com]
> Sent: Thursday, November 07, 2002 4:23 PM
> To: gnhlug-discuss at mail.gnhlug.org
> Cc: nh-pm at mail.pm.org
> Subject: HTML/CGI.pm question
> 
> 
> 
> Hey,
> 
> Anyone know how to make those neat little pop-up windows in Netscape?
> 
> I'm want to connect an href element to a new window which also 
> contains a "close window" button.
> 
> I've created a "phone list" cgi, and now I want to be able to click 
> on an employee's name, pop up a new window, and have all their 
> relevant information in it like ext, mgr, group, etc.
> 
> (This is all done using CGI.pm, so if you know the actual perl code 
> to do this, that would be cool too :)

Controlling the browser objects, such as windows, is outside the
 ability of a server-side programming language like Perl or PHP or
 even JSP (but not Java applets).  The most often-used way of
 achieving this effect is to use JavaScript.

So basically, all you have to do is echo out the JavaScript code
 to create a popup window from whatever is echoing out your HTML.
  JavaScript is embedded in HTML code but often hidden from view
  (by modern browsers), and is processed by the browser.  You use
  the "window.open()" method to actually open it, and there is a
  handful of arguments to this method that let you specify the
  dimensions, location, contents, and whether or not there should
  be a toolbar at the top of this window.

There are quite a few tutorials on the web that explain the
 actual process of doing it.  The tricky part is that you're
 probably wanting to access data that is dynamically generated
 by Perl code.  In this case, you want to make sure that the
 URL you specify will point to a document that has that data.
  In other words, if you determine what content to echo out
  based on some GET variables, you'll have to include those
  GET variables in the URL that you pass to your "window.open()"
  method.

It's not really difficult but takes some mind-bending at first,
 since you're essentially

1. echoing out one programming language from within another
 programming language (JavaScript from within Perl)
2. want to make sure that the argument that you echo out from
 your Perl to your JavaScript "window.open()" method has the
 properly composed HTTP GET request that will tell the receiving
 Perl script what data to echo to *that* window (the mini-window).

Kind of confusing to explain.  If I didn't have to run to class
 I'd be able to get into more detail, but I'm sure you'll be
 fine, this is pretty easy to do.



Erik


(Hand-wrapped b/c I can't figure out how to get my mail client
to wrap it :(   )



More information about the gnhlug-discuss mailing list