#!/usr/bin/perl -w use strict; use warnings; use CGI; my $co = new CGI; my $color = 'red'; print $co->header; print $co->start_html(); print $co->start_form; print $co->radio_group( -name => 'color', -id => 'color', -values => ['red','yellow','green'], -default => 'red', -onClick => "return select_color(this)" ).$co->p; print $co->textarea( -id => "textarea", -style=> "background-color:$color; color:blue", ); print $co->end_form; print $co->end_html; print < function select_color(rb_obj) { var color = rb_obj.value; var ta_obj = document.getElementById('textarea'); ta_obj.style.background = color; return color; } COLOR_SCRIPT