Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed with "onMouseOver" event

Status
Not open for further replies.

jlawler

Programmer
Feb 26, 2003
14
IE
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, &quot;30&quot;, &quot;1&quot;, &quot;/images/img1.gif&quot;, &quot;SubmitForm('selectqq')&quot;, &quot;Get Quote&quot;) %>

and the function is:

public String getInputButtonHtml (HttpServletRequest request, String width, String height, String src, String action, String alt)
{
String buttonHtml = new String(&quot;&quot;);

buttonHtml = &quot;<a cursor=\&quot;hand\&quot; href=\&quot;javascript:&quot;;
buttonHtml = buttonHtml + action + &quot;;\&quot; onMouseOver=\&quot;self.status='&quot; + alt + &quot;';return true;\&quot; onMouseOut=\&quot;self.status='';return true;\&quot;><img src=\&quot;&quot;;
buttonHtml = buttonHtml + src + &quot;\&quot; alt=\&quot;&quot;;
buttonHtml = buttonHtml + alt + &quot;\&quot; border=\&quot;0\&quot; vspace=\&quot;0\&quot; hspace=\&quot;0\&quot;></a>&quot;;

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top