Javascript Image Button Perl Module


Here is an example page.
Here is the JSImButton.pm module.

What is it?

It is a perl 5 module for simulating push buttons on an HTML page. The down button image is shown when the mouse is in the image, and the up button image is shown otherwise. An action is executed when the image is clicked.

How do I use it?

  1. Get a copy of the JSImButton.pm module.
  2. In the CGI-Script that generates buttons, add the directory containing JSImButton.pm to the @INC array.
  3. Use the module i.e. use JSImButton.pm;
  4. Create a new instance of the object for each button you want.
  5. Call the object's show() method to print it out.

Methods

Constructor:
JSImButton(<Up Image>,<Down Image>,<Button Action>)

$b = new JSImButton("up.gif","down.gif","http://blah.com");
$b = new JSImButton("up.gif","down.gif","javascript:window.close()");

Set Spacing:
setSpacing("<on|off|true|false|yes|no>")

$b->setSpacing("yes");
$b->setSpacing("on");

Set Handlers:
setMouseOver(<Mouse Over Action>)
setMouseOut(<Mouse Over Action>)

$b->setMouseOver("alert(\"testing\");window.status=\"testing\";return true");