0
我打算創建一個使用CGI.pm 以下HTML它只是包含2幀的鏈接。如何命名使用CGI.pm
--------------------------------
Frame1 |
link1 | Frame2
link2 |
etc |
---------------------------------
用戶會點擊第1幀中的鏈接,結果會出現在 幀2
要做到這一點我想的名字在幀1的CGI腳本「鏈接1」等(如圖查詢), ,然後出現在Frame2中(作爲響應)。 我不知道如何在CGI中實現。
這是當前腳本我有:
#!/usr/bin/perl -w
use CGI::Carp qw(fatalsToBrowser);
use CGI qw/:standard/;
my $TITLE = "My title";
my $query = new CGI;
my $path_info = $query->path_info;
print $query->header();
$path_info = $query->path_info();
# If no path information is provided, then we create
# a side-by-side frame set
if (!$path_info) {
&print_frameset;
exit 0;
}
&print_html_header;
&print_query if $path_info=~/query/;
&print_response if $path_info=~/response/;
&print_end;
sub print_html_header {
print
$query->start_html(-title =>'My title',
-bgcolor=> "F5F5EB",
-style => {
-src => '../print.css',
-align=>'center',
}
),p;
}
sub print_end {
print $query->end_html;
}
# Create the frameset
sub print_frameset {
my $script_name = $query->script_name;
print <<EOF;
<html><head><title>$TITLE</title></head>
<frameset cols="35,65" frameborder=0 marginwidth=0 noresize>
<frame src="$script_name/query" name="query">
<frame src="$script_name/response" name="response">
</frameset>
EOF
;
exit 0;
}
sub print_query {
$script_name = $query->script_name;
print "<H1>Frame1</H2>\n";
# This is where I want to name "Link1" so that
# it can be called later in response frame
# But this doesn't seem to work
print h3("Link1", -name =>'link1");
}
sub print_response {
print "<H1>Frame2</H2>\n";
# If name == link1 do something...
}