Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Form button with image and reset?

Posted on 2000-03-11
4
Medium Priority
?
195 Views
Last Modified: 2010-04-09
Could someone provide HTML code that uses a form in which exists an input field (where the user can type) plus two images which will serve as buttons.  One image will be "Reset" and the other image will be "Submit".   I do not want to see the standard gray rectangular buttons...instead, I want to replaced them with images.

Thanks.
0
Comment
Question by:Kapusta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 8

Accepted Solution

by:
jbirk earned 200 total points
ID: 2608998
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form action="acgi.cgi" name="theForm">
<input type="text" name="textField" value="Text field!" size="20" maxlength="15">
<BR>
<input type="image" name="submitImage" src="submit.gif" width="40" height="15">
<input type="image" name="resetImage" src="reset.gif" width="40" height="15" onClick="document.theForm.reset(); return false;">
</form>
</body>
</html>


Explanation to follow...
-Josh
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2609010
OK, first the input field is simply an input tag of type text.  You can specify the size of the field as well as the max number of characters as I have (at 15).  The maxlength is optional of course.  Also the default value which is displayed in the field can also be displayed.  I put "text field!"...  This can be left out as well if you want it to be blank.

To have an image for submit and reload, you first will need the images you want to use.  Then use the input type "image" as I've done above.  When the user clicks on this image it submits the form and sends the coordinates of where the user clicked on the image.  This data will probably be meaningless for you so you can just ignore it...  To do a reset with a custom image though requires a little javascript...  You can use the input type "image" like I did above, or even just a normal img tag:
<A HREF="JavaScript:;" onClick="document.theForm.reset(); return false;"><IMG src="reset.gif" width="40" height="15"></A>

Either way it will reset the form...

Oh, and similarly you can submit the form with a normal image tag if you use javascript.  The same as above, with reset changed to submit:
<A HREF="JavaScript:;" onClick="document.theForm.submit(); return false;"><IMG src="submit.gif" width="40" height="15"></A>


Either way, its up to you...

If you have any further question on this, feel free to ask.
-Josh
0
 

Author Comment

by:Kapusta
ID: 2609094
So I take it that it is impossible to have an Image button perform a Reset without using Javascript?

I had hoped to avoid Javascript.
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2609456
Sorry, not possible:(  Why hope to avoid JavaScript though?  It's very commonly supported by the browsers.  I believe the code used in this question is 1.0, so that means Netscape 2.0+ and IE 3.0+.  That's pretty good support, and few people disable JavaScript anymore, because so many pages rely on it and don't function at all without it...  It's not really something you have to worry about anymore.

-Josh
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question