#!/usr/local/bin/perl
use CGI;
$query = new CGI;
print $query->header();
$query->start_html(-title=>'Wow!',-script=>-language=>'JavaScript',
src=>'s.js');
print $query->h1('Wow!');
my %sample =(
component1=> ["command1", "command2"," command3"],
component2 => ["command1"," command2"," command3"],
);
while (($mykey, $myval) = each %sample)
{
push(@mykey, $mykey);
}
#print @mykey;
print $query->startform();
print $query->checkbox(-name=>"all",
-value=>'ALL',
-linebreak=>'true',
-onClick=>"checkAll(document.form.@mykey)"
);
foreach $key (keys %sample) {
foreach $i (0.. $#{$sample{$key}}){
print $query->checkbox_group(-name=>"$key",
values=>["@{$sample{$key}}[$i]"],
-linebreak=>'true',
-labels=>\%sample,
);
}
}
@turned_on = $query->param('$key');
print @turned_on;
print $query->endform;
$query->end_html();