in reply to JavaScript and Perl Subroutine

While you can't do it directly you can play some games with javascript and your perl code to effect a similar type thing

This can be done without the javascript by setting the name of the logout button to something you can grab in your script. This approach allows you to do this for stuff other than buttons though. (i.e. changing a value in a dropdown etc)

HTML Stuff <script language="JavaScript"> function logout { var dynamicInput = document.createElement("INPUT"); dynamicInput.type = "hidden"; dynamicInput.name = "action_logout"; document.main_form.appendChild(dynamicInput); document.main_form.submit(); } </script> <form method=POST action=allExaminations.pl name="main_form"> <input type=submit name=logout value=logout onClick="logout()"> </form> Perl Stuff inside allExaminations.pl my $q = new CGI; # # Look for an action value and return it # sub GetAction { my $q = shift(); my $cgi_parms = $q->Vars(); foreach my $key (keys(%$cgi_parms)) { if ($key =~ /^action/) { return $key; } } } if(GetAction($q) =~ /action_logout/) { DoLogoutSub(); }
not tested etc.