Html 如何使用CGI.pm命名链接

Html 如何使用CGI.pm命名链接,html,linux,perl,unix,cgi,Html,Linux,Perl,Unix,Cgi,我打算使用CGI.pm创建以下HTML 它只包含两个帧 -------------------------------- Frame1 | link1 | Frame2 link2 | etc | --------------------------------- 用户将单击第1帧中的链接,结果将显示 在第2帧中 为此,我想在Frame1中的cgi脚本中命名“link1”等(作为查询),

我打算使用CGI.pm创建以下HTML 它只包含两个帧

--------------------------------
   Frame1          |
   link1           |  Frame2
   link2           |
   etc             |
---------------------------------
用户将单击第1帧中的链接,结果将显示 在第2帧中

为此,我想在Frame1中的cgi脚本中命名“link1”等(作为查询), 然后出现在第2帧中(作为响应)。 我不知道如何在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...
}
#/usr/bin/perl-w
使用CGI::Carp qw(fatalsToBrowser);
使用CGI qw/:标准/;
my$TITLE=“my TITLE”;
my$query=新CGI;
我的$path\u info=$query->path\u info;
打印$query->header();
$path_info=$query->path_info();
#如果没有提供路径信息,则创建
#并排的架子
如果(!$path\u info){
&打印框架集;
出口0;
}
&打印html标题;
&如果$path\u info=~/query/,则打印\u query;
&如果$path_info=~/response/,则打印_响应;
&打印结束;
子打印\u html\u标题{
印刷品
$query->start_html(-title=>“我的标题”,
-bgcolor=>“f5eb”,
-风格=>{
-src=>“../print.css”,
-对齐=>“中心”,
}
),p;
}
副打印结束{
打印$query->end\u html;
}
#创建框架集
子打印框架集{
我的$script\u name=$query->script\u name;

打印在子打印查询中,只需执行以下操作:

print a({-href=>"$script_name/whatever_you_want", -target=>'response'}, "Link1"),