onclick does not work with reset?

L

Lee

chirs said:
Hi,

In a website

http://www.devguru.com/Technologies/ecmascript/quickref/evhan_onclick.html

it says:

The following example shows the use of the onClick event handler to
offer users the chance to cancel the resetting of a from when clicking
on a Reset button.

Code:
<INPUT TYPE="RESET" onClick="return confirm('Are you sure?')">

I added an input box with this code in a form. But the reset button
always clear input box. What's wrong?

Did you copy that code exactly, or did you forget the "return"?
What browser are you using for testing?
 
L

Lasse Reichstein Nielsen

Code:
<INPUT TYPE="RESET" onClick="return confirm('Are you sure?')">

I added an input box with this code in a form. But the reset button
always clear input box. What's wrong?

I expect you have a Javascript error. Turn error reporting on and tell
us what it says :)

A guess: Do you have any form controls, forms, or global variables
called "confirm"? If so, rename them.

/L
 
C

chirs

Lee said:
chirs said:

Did you copy that code exactly, or did you forget the "return"?
What browser are you using for testing?

You are right, I did not put return.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top