Hi
tarunkhanna,
As other have noted, this hasn't anything to do with perl.
But since you're pretty close, try doing this:
#!/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 <<COLOR_SCRIPT;
<script language="JavaScript">
function select_color(rb_obj) {
var color = rb_obj.value;
var ta_obj = document.getElementById('textarea');
ta_obj.style.background = color;
return color;
}
</script>
COLOR_SCRIPT
Note that it passes "this" to the function select_color, so that the value will change with the color. The id of the text_area object is then looked up, and its style.background is assigned to the current color.
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.