Make Interactive Pages

Cute trick for changing the appearance of the page on the fly.

Script II.1.4: customizable.pl

 #!/usr/bin/perl
 # script: customizable.pl
 
 use CGI qw/:standard/;
 
 $color = param('color') || 'white';
 
 print header,
     start_html({-bgcolor=>$color},'Customizable Page'),
     h1('Customizable Page'),
     "Set this page's background color to:",br,
     start_form,
     radio_group(-name=>'color',
 		    -value=>['white','red','green','black',
 			     'blue','silver','cyan'],
 		    -cols=>2),
     submit(-name=>'Set Background'),
     end_form,
     p,
     hr,
     end_html;

What it Looks Like

http://localhost/cgi-bin/conference/customizable.pl
<< Previous Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Mon Aug 17 10:46:51 EDT 1998