You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thinh Doan <th...@tds.net> on 2001/09/26 23:28:46 UTC

Use an image for submit button

I'd like to replace the following with an image instead of a button:
      <html:submit property="submit" value="Login"
styleClass="verdanaCAPCopy"/>

Is there a way to do it?  In html, it's <a...><img...></a>

Thank you for your response.

Thinh


RE: Use an image for submit button

Posted by Thinh Doan <td...@twjconsulting.com>.
Thanks Eric & Marcelo.  I tried <html:image...> and it seems to work fine.
I used <a href="javascript:document.forms[0].submit();"> a lot in the past
(for img rollover) but thought to try the "Struts" way.

Thinh

-----Original Message-----
From: Eric Rizzo [mailto:erizzo@opennetwork.com]
Sent: Thursday, September 27, 2001 9:01 AM
To: struts-user@jakarta.apache.org
Subject: Re: Use an image for submit button


Thinh Doan wrote:

> I'd like to replace the following with an image instead of a button:
>       <html:submit property="submit" value="Login"
> styleClass="verdanaCAPCopy"/>


I just learned this the other day myself.  For some reason, an <input
type="image" ...> will submit the form when clicked.  So just use the Struts
tag
<html:image page="relativePathToImageFile" ...> in your JSP.

Also noted that someone posted yesterday the following that might be an
alternative:

> You can use <a href="javascript:forms[0].submit();"> to make
> link, which submits. (I am not sure, whether the syntax above is ok)



HTH,
	Eric
--
Eric Rizzo, Software Engineer
OpenNetwork Technologies
http://www.opennetwork.com
-----------------------------
I embrace my personality flaws, for without them
I might have no personality at all.



Re: Use an image for submit button

Posted by Eric Rizzo <er...@opennetwork.com>.
Thinh Doan wrote:

> I'd like to replace the following with an image instead of a button:
>       <html:submit property="submit" value="Login"
> styleClass="verdanaCAPCopy"/>


I just learned this the other day myself.  For some reason, an <input 
type="image" ...> will submit the form when clicked.  So just use the Struts tag 
<html:image page="relativePathToImageFile" ...> in your JSP.

Also noted that someone posted yesterday the following that might be an alternative:

> You can use <a href="javascript:forms[0].submit();"> to make
> link, which submits. (I am not sure, whether the syntax above is ok)
 


HTH,
	Eric
-- 
Eric Rizzo, Software Engineer
OpenNetwork Technologies
http://www.opennetwork.com
-----------------------------
I embrace my personality flaws, for without them
I might have no personality at all.


Re: Use an image for submit button

Posted by Marcelo Vanzin <va...@rededc.com.br>.
Thinh Doan wrote:

> Is there a way to do it?  In html, it's <a...><img...></a>


	Actually in HTML it's more like <input type="image" ...>, which you have 
in Struts in the form of <html:image ...>.


	http://jakarta.apache.org/struts/struts-html.html#image

-- 
[]'s
Marcelo Vanzin
Touch Tecnologia
vanza@rededc.com.br
"We're an underground revolution working overtime"