Forum Moderators: open

Message Too Old, No Replies

using a button image to submit a form

         

sssweb

8:59 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



I thought this would be simple but I can't find it in any tutorial:

How do I replace the standard 'Submit' button in a form with a custom image?

Robin_reala

10:02 pm on Sep 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, simple :)

<input type="image" src="my_image.png" alt="The text in my image" />

Both type="image" and type="submit" will submit a form.

sssweb

10:18 pm on Sep 13, 2006 (gmt 0)

10+ Year Member



Thanks, that works...knew that was simple ;)

Does it matter if I include 'name' or 'value' specs with it, as on a regular Submit button?

i.e. <input type="submit" name="submit" value="Click Here" />

rocknbil

1:06 am on Sep 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Any name but THAT name. :-) Well I suppose it's OK if you don't have any Javascript on your page, "submit" is a function:

document.forms['formname'].submit();

To ba safe, call it submit_button or something. While your at it, add an ID.

Robin_reala

5:57 am on Sep 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



@value isn't needed, as it's just the text in a normal button. The alternative text on an image button is handled by the alt attribute.