Using an Image for an HTML submit action

back to contents

Introduction

Normally, HTML form "submit action" buttons are actual buttons generated by the HTML browser. What if you want to replace this default functionality with an image that you want people to click in order to go somewhere. This can be seen in the follwing webpage:

The "Go!" image does a form post operation. The code below will do the following.

HTML snippet

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
  <meta name="Author" content="Nazmul Idris">
</head>
<body>

<form method="post" target="http://host/servlet/PostServlet">
  <input type="text">
  <input type="image" border=0 value="Submit" name="Submit" src="go.gif">
</form>

</body>
</html>

Nazmul Idris