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)
not tested 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(); }
In reply to Re: JavaScript and Perl Subroutine
by amw1
in thread JavaScript and Perl Subroutine
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |