htmlform-submitsubmit-button

How do I use an image as a submit button?


Can someone help to change this to incorporate an image called BUTTON1.JPG instead of the standard submit button?

<form id='formName' name='formName' onsubmit='redirect();return false;'>
    <div class="style7">
        <input type='text' id='userInput' name='userInput' value=''>
        <input type='submit' name='submit' value='Submit'>
    </div>
</form> 

Solution

  • Use an image type input:

    <input type="image" src="/Button1.jpg" border="0" alt="Submit" />
    

    The full HTML:

    <form id='formName' name='formName' onsubmit='redirect();return false;'>
      <div class="style7">
        <input type='text' id='userInput' name='userInput' value=''>
        <input type="image" name="submit" src="https://jekyllcodex.org/uploads/grumpycat.jpg" border="0" alt="Submit" style="width: 50px;" />
      </div>
    </form>