|
Support for Frames
Support for Frames
CGI.pm contains support for
HTML frames,
a feature of Netscape 2.0 and higher, and Internet Explorer 3.0 and higher.
Frames are supported in two ways:
- You can provide the name of a new or preexisting frame in
the startform() and start_multipart_form() methods using the -target parameter.
When the form is submitted, the output will be redirected to the indicated
frame:
- print
$query->start_form(-target=>'result_frame');
- You can direct the output of a script into a new window
or into a preexisting named frame by providing the name of the frame as a
-target argument in the header method. For example, the following code will pop
up a new window and display the script's output:
- $query = new CGI;
- print
$query->header(-target=>'_blank');
This
feature is a non-standard extension to HTTP which is supported by Netscape
browsers, but not by Internet Explorer.
Using frames effectively can be tricky. To create a
proper frameset in which the query and response are displayed side-by-side
requires you to divide the script into three functional sections. The first
section should create the <frameset> declaration and exit. The second
section is responsible for creating the query form and directing it into the one
frame. The third section is responsible for creating the response and directing
it into a different frame.
|
|