use CGI; $co = new CGI; 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()" ).$co->p; #How to handle $color below so that whatever color i select with radiobutton that color is displayed in textarea?? print $co->textarea( -style=>"background-color:$color; color:blue", ); print $co->end_form; print $co->end_html; print < function select_color() { var color = document.getElementById('color').value; return color; } COLOR_SCRIPT