...

View Full Version : can i use an image as reset button ?



HormonX
12-05-2002, 12:20 AM
i know i can use an image as a submit button, but can i use one as a reset button ?

thanx

HormonX

chrismiceli
12-05-2002, 12:28 AM
i am almost positive the syntax is like this
<img src="rst.jpg" type="submit">

HormonX
12-05-2002, 01:50 AM
well .. i know the syntax for submit button as an image ... and it actually goes like this ...




<input type='image' name='submit' value="submit" src='image.gif" border="0">



the question is .. if and how can i use a button to clear a form.

HormonX

Roy Sinclair
12-05-2002, 04:12 PM
<form name="myform">

...

<a href="Reset the form" onclick="document.forms["myform"].reset();return false;"><img src="myresetimage" /></a>
<noscript>
Since you don't have Javascript enabled, use only this button to reset the form <input type="reset" value="Reset the Form Here" />
</noscript>
</form>

HormonX
12-05-2002, 04:35 PM
thanx,

the code works fine ... there is only one problem ... when the page loads everything worksfine ..but when i press reset .. and page resets .... i get an error message from javascript.

Line: 122
Char: 1
Error: Syntax Error
Code: 0
URL: www.mypage.com/contact.php

And line 122 is empty ...

any idea why this might be happening ?

HormonX

Roy Sinclair
12-05-2002, 05:10 PM
I can't tell without seeing the code but as a first guess I'd suspect that you've got a typo. My usual problem is spelling false as flase :)

glenngv
12-09-2002, 08:14 AM
use single quotes instead:

<a href="Reset the form" onclick="document.forms['myform'].reset();return false;"><img src="myresetimage" /></a>

Kiwi
12-09-2002, 11:45 AM
A general debugging tip for javascript (and php): the error may not become apparent until a few lines after you entered it. This is especially true of missing quotes (something I keep doing, so I know this well). If you get an error on a line, look backwards from that line for a problem.

Since the answer's already posted, I probably didn't need to add that.

zoobie
12-09-2002, 12:35 PM
Try:

<button type="reset"><img src="pic.jpg"></button> :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum