SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I insert an image for a button?

    This is my submit button right now:

    <input name="Submit2" type="submit" value="Submit">

    I want to make it a jpg
    Opportunity favors the prepared mind.

  2. #2
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    Code HTML4Strict:
    <input src="image.jpg" name="Submit2" value="" type="image">

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ben, you forgot the important alt attribute, which is required for image inputs!

    Code HTML4Strict:
    <input type="image" name="Submit2" src="image.jpg" alt="Submit" value="Submit">
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you! it worked perfectly
    Opportunity favors the prepared mind.

  5. #5
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,564
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    Ben, you forgot the important alt attribute, which is required for image inputs!

    Code HTML4Strict:
    <input type="image" name="Submit2" src="image.jpg" alt="Submit" value="Submit">
    Not only is it required just for image inputs, it's required in general for images, if you need to follow the 508.
    Twitter-@Ryan_Reese09
    http://www.ryanreese.us -Always looking for web design/development work

  6. #6
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    Ben, you forgot the important alt attribute, which is required for image inputs!

    Code HTML4Strict:
    <input type="image" name="Submit2" src="image.jpg" alt="Submit" value="Submit">
    Indeed I did

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RyanReese View Post
    Not only is it required just for image inputs, it's required in general for images, if you need to follow the 508.
    For the img element type the alt attribute is required if you want to follow HTML (or XHTML).

    For input elements it's only required if type="image".
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •