Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.1 KiB

  1. #!/usr/local/bin/perl
  2. use CGI;
  3. $query = new CGI;
  4. print $query->header;
  5. $TITLE="Frameset Example";
  6. # We use the path information to distinguish between calls
  7. # to the script to:
  8. # (1) create the frameset
  9. # (2) create the query form
  10. # (3) create the query response
  11. $path_info = $query->path_info;
  12. # If no path information is provided, then we create
  13. # a side-by-side frame set
  14. if (!$path_info) {
  15. &print_frameset;
  16. exit 0;
  17. }
  18. # If we get here, then we either create the query form
  19. # or we create the response.
  20. &print_html_header;
  21. &print_query if $path_info=~/query/;
  22. &print_response if $path_info=~/response/;
  23. &print_end;
  24. # Create the frameset
  25. sub print_frameset {
  26. $script_name = $query->script_name;
  27. print <<EOF;
  28. <html><head><title>$TITLE</title></head>
  29. <frameset cols="50,50">
  30. <frame src="$script_name/query" name="query">
  31. <frame src="$script_name/response" name="response">
  32. </frameset>
  33. EOF
  34. ;
  35. exit 0;
  36. }
  37. sub print_html_header {
  38. print $query->start_html($TITLE);
  39. }
  40. sub print_end {
  41. print qq{<P><hr><A HREF="../index.html" TARGET="_top">More Examples</A>};
  42. print $query->end_html;
  43. }
  44. sub print_query {
  45. $script_name = $query->script_name;
  46. print "<H1>Frameset Query</H1>\n";
  47. print $query->startform(-action=>"$script_name/response",-TARGET=>"response");
  48. print "What's your name? ",$query->textfield('name');
  49. print "<P>What's the combination?<P>",
  50. $query->checkbox_group(-name=>'words',
  51. -values=>['eenie','meenie','minie','moe']);
  52. print "<P>What's your favorite color? ",
  53. $query->popup_menu(-name=>'color',
  54. -values=>['red','green','blue','chartreuse']),
  55. "<P>";
  56. print $query->submit;
  57. print $query->endform;
  58. }
  59. sub print_response {
  60. print "<H1>Frameset Result</H1>\n";
  61. unless ($query->param) {
  62. print "<b>No query submitted yet.</b>";
  63. return;
  64. }
  65. print "Your name is <EM>",$query->param(name),"</EM>\n";
  66. print "<P>The keywords are: <EM>",join(", ",$query->param(words)),"</EM>\n";
  67. print "<P>Your favorite color is <EM>",$query->param(color),"</EM>\n";
  68. }