Hi,
I have a piece of code, that sets up a button on a form and when this button is clicked the form is submitted. This button is implemented in a separate function, in an included file.
I need to update this function, so that when the mouse is moved over the button, the image changes; and then changes back when the mouse is moved away from the button.
The origional function call is:
<%= support.getInputButtonHtml (request, "30", "1", "/images/img1.gif", "SubmitForm('selectqq')", "Get Quote"
%>
and the function is:
public String getInputButtonHtml (HttpServletRequest request, String width, String height, String src, String action, String alt)
{
String buttonHtml = new String(""
;
buttonHtml = "<a cursor=\"hand\" href=\"javascript:";
buttonHtml = buttonHtml + action + ";\" onMouseOver=\"self.status='" + alt + "';return true;\" onMouseOut=\"self.status='';return true;\"><img src=\"";
buttonHtml = buttonHtml + src + "\" alt=\"";
buttonHtml = buttonHtml + alt + "\" border=\"0\" vspace=\"0\" hspace=\"0\"></a>";
return buttonHtml;
}
The first image is passed as a parameter to the function. (This is the image that should appear when the mouse is not over the button). So if I pass the second image to the function as another parameter, how can I edit the function so that it will swap them wheather the mouse is over the button or not.
Any help is much appreciated
Thanks
jlawler
I have a piece of code, that sets up a button on a form and when this button is clicked the form is submitted. This button is implemented in a separate function, in an included file.
I need to update this function, so that when the mouse is moved over the button, the image changes; and then changes back when the mouse is moved away from the button.
The origional function call is:
<%= support.getInputButtonHtml (request, "30", "1", "/images/img1.gif", "SubmitForm('selectqq')", "Get Quote"
and the function is:
public String getInputButtonHtml (HttpServletRequest request, String width, String height, String src, String action, String alt)
{
String buttonHtml = new String(""
buttonHtml = "<a cursor=\"hand\" href=\"javascript:";
buttonHtml = buttonHtml + action + ";\" onMouseOver=\"self.status='" + alt + "';return true;\" onMouseOut=\"self.status='';return true;\"><img src=\"";
buttonHtml = buttonHtml + src + "\" alt=\"";
buttonHtml = buttonHtml + alt + "\" border=\"0\" vspace=\"0\" hspace=\"0\"></a>";
return buttonHtml;
}
The first image is passed as a parameter to the function. (This is the image that should appear when the mouse is not over the button). So if I pass the second image to the function as another parameter, how can I edit the function so that it will swap them wheather the mouse is over the button or not.
Any help is much appreciated
Thanks
jlawler