Creating a Clickable Image Button
Creating a Clickable Image Button
Named parameter style
print
$query->image_button(-name=>'button_name',
-src=/eng/catalog/pages/comp/843/font>
-align=>'MIDDLE');
Old style
print
$query->image_button('button_name','/source/URL','MIDDLE');
image_button() produces an inline image that acts
as a submission button. When selected, the form is submitted and the clicked
(x,y) coordinates are submitted as well.
- The first argument(-name is required and specifies
the name of this field.
- The second argument (-srcspecifies the URL of the
image to display. It must be one of the types supported by inline images (e.g.
GIF), but can be any local or remote URL.
- The third argument (-alignis anything you might
want to use in the ALIGN attribute, such as TOP, BOTTOM, LEFT, RIGHT or MIDDLE.
This field is optional.
When the image
is clicked, the results are passed to your script in two parameters named
"button_name.x" and "button_name.y", where "button_name" is the name of the
image button.
$x =
$query->param('button_name.x');
$y =
$query->param('button_name.y');
JavaScripting: Current versions of JavaScript do
not honor the -onClick handler, unlike other buttons.
|