WORKING WITH FRAMES
It's possible for CGI.pm scripts to write into several browser panels and windows using the HTML 4 frame mechanism. There are three techniques for defining new frames programmatically:
1. Create a
<Frameset> document
After writing out the HTTP header, instead of creating a standard HTML document using the
start_html() call, create a
<FRAMESET> document that defines the frames on the page. Specify your script(s) (with appropriate parameters) as the SRC for each of the frames.
There is no specific support for creating
<FRAMESET> sections in CGI.pm, but the HTML is very simple to write. See the frame documentation in Netscape's home pages for details
http://home.netscape.com/assist/net_sites/frames.htm
2. Specify the destination for the document in the HTTP header
You may provide a -target parameter to the
header() method:
Code:
print $q->header(-target=>'ResultsWindow');
This will tell the browser to load the output of your script into the frame named ``ResultsWindow''. If a frame of that name doesn't already exist, the browser will pop up a new window and load your script's document into that. There are a number of magic names that you can use for targets. See the frame documents on Netscape's home pages for details.
3. Specify the destination for the document in the
<FORM> tag
You can specify the frame to load in the FORM tag itself. With CGI.pm it looks like this:
Code:
print $q->start_form(-target=>'ResultsWindow');
When your script is reinvoked by the form, its output will be loaded into the frame named ``ResultsWindow''. If one doesn't already exist a new window will be created.
The script ``frameset.cgi'' in the examples directory shows one way to create pages in which the fill-out form and the response live in side-by-side frames.