3 Replies - 562 Views - Last Post: 07 May 2013 - 11:05 AM

#1 noahwilson  Icon User is offline

  • New D.I.C Head

Reputation: -8
  • View blog
  • Posts: 26
  • Joined: 06-May 13

use image with button?

Posted 07 May 2013 - 10:06 AM

Hello Guys,
I want to use image with form submit button to make it attractive, so guys help me and suggest how can i add image on button.
Thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: use image with button?

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3465
  • View blog
  • Posts: 11,753
  • Joined: 12-December 12

Re: use image with button?

Posted 07 May 2013 - 10:26 AM

input type="image"

is a submit button with an image:

<input type="image" src="someimage.gif" alt="alt text" />


.. or use css, or an image inside the submit button.

This post has been edited by andrewsw: 07 May 2013 - 10:26 AM

Was This Post Helpful? 0
  • +
  • -

#3 geohhot  Icon User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 33
  • Joined: 22-December 12

Re: use image with button?

Posted 07 May 2013 - 10:32 AM

Oh I see several ways to do that, this one is easiest I think, without javascript.
<input type="submit" style="background-image:url('someImage.png')" />


Which I don't think is a good idea. And another is using javascript like this:
<form id="blahForm" method="POST">
<img src="submit.jpg" onclick="document.getElementById('blahForm').submit();" />
</form>


The second way will force javascript to submit form everytime image will be clicked.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,227
  • Joined: 08-June 10

Re: use image with button?

Posted 07 May 2013 - 11:05 AM

I usually prefer <button> elements for that task.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1