html - How to name a link using CGI.pm -
i intend create following html using cgi.pm contain 2 frames.
-------------------------------- frame1 | link1 | frame2 link2 | etc | --------------------------------- the user click link in frame 1 , result appear in frame 2.
to want name "link1" etc in cgi-script in frame1 (as query), , appear in frame2 (as response). i'm not sure how achieve in cgi.
this current script have:
#!/usr/bin/perl -w use cgi::carp qw(fatalstobrowser); use cgi qw/:standard/; $title = "my title"; $query = new cgi; $path_info = $query->path_info; print $query->header(); $path_info = $query->path_info(); # if no path information provided, create # 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 frameset sub print_frameset { $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"; # want name "link1" # can called later in response frame # doesn't seem work print h3("link1", -name =>'link1"); } sub print_response { print "<h1>frame2</h2>\n"; # if name == link1 something... }
in sub print_query, do:
print a({-href=>"$script_name/whatever_you_want", -target=>'response'}, "link1"),
Comments
Post a Comment