Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change the Reset button image?? pls

Status
Not open for further replies.

fterrazas

Technical User
Dec 29, 2000
43
ES
Hi, I want to know how can I change the ugly image of the reset button in a form for an image of my own, I know that you can do this with the submit button with this code:
inpuy type="image" src="image.jpg"
But what about the reset button? I can change the image? Please help me with this. Thanks to all.
 
Hi

I think you need to use a javascript to do this.

Use the input tag to set the image and to call tha javascript.
Something like this:

<input type=&quot;image&quot; onclick=&quot;resetform()&quot;>

the javascipt could be something like this:

function resetform() {
formname.fieldname.value=&quot;&quot;
}
 
Both examples will work well in IE (I only use/tested 4.0):

<FORM method=&quot;POST&quot; name=&quot;form_name&quot; action=&quot;thatpage.htm&quot;>
<IMG src=&quot;yourimage&quot; onclick=&quot;form_name.reset()&quot;>
</FORM>

<FORM method=&quot;POST&quot; name=&quot;form_name&quot; action=&quot;thatpage.htm&quot;>
<A onfocus=&quot;blur()&quot; href=&quot;form_name.reset()&quot;>
<IMG border=&quot;0&quot; width&quot;..&quot; height=&quot;..&quot; src=&quot;yourimage&quot;>
</A>
</FORM>

[red] onfocus=&quot;blur()&quot; is to avoid the annoying dashed border after clicking the link[/red]

In NN (I only use/tested 4.73) this wil work (and also in IE):

<FORM method=&quot;POST&quot; name=&quot;form_name&quot; action=&quot;thatpage.htm&quot;>
<A onfocus=&quot;blur()&quot; href=&quot;#&quot; onclick=&quot;form_name.reset()&quot;>
<IMG border=&quot;0&quot; src=&quot;yourimage&quot; width=&quot;..&quot; height=&quot;..&quot;>
</A>
</FORM>

The only thing is:
In NN the cursor will stay onfocus in waiting position after clicking this link. It will disappear after you click in your form to fill in some new values

Hope this helps,
Erik

Maybe someone else can give an answer about the waiting cursor?

Is there probably a way to make a javascript function with:

function do_reset()
{
form_name.reset();
[red]here some additional code to stop the cursor[/red]
}

 
Hi all,

This is just an idea, but perhaps the following could work:

Code:
function do_reset()
{
  form_name.reset();
  window.focus();
}

This would set focus on the document. Thus, removing it from the link.

Gtz,

Kristof -------------------
Check out my new site:

Any suggestions are more than welcome.
There's a LOT of work to do, so judge fairly. :)
 
Hi,

I've been testing a bit and this seems to work just fine
(also using NS 4.7)

Code:
<html>
<head>
	<title>Form Reset</title>
	<script language=&quot;JavaScript&quot;>
		function do_reset()
		{
		  document.form_name.reset();
		  window.focus();
		}
	</script>
</head>
<BODY>
<FORM method=&quot;POST&quot; name=&quot;form_name&quot; action=&quot;thatpage.htm&quot;>
<input type=&quot;text&quot; name=&quot;textfield1&quot;>
<A href=&quot;javascript:do_reset()&quot;><IMG border=&quot;0&quot; src=&quot;someimage&quot; width=&quot;..&quot; height=&quot;..&quot;></A>
</FORM>
</body>
</html>

Gtz,

Kristof -------------------
Check out my new site:

Any suggestions are more than welcome.
There's a LOT of work to do, so judge fairly. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top