onclick does not work with reset?

Discussion in 'Javascript' started by chirs, Nov 28, 2003.

  1. chirs

    chirs Guest

    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?
     
    chirs, Nov 28, 2003
    #1
    1. Advertisements

  2. chirs

    Lee Guest

    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?
     
    Lee, Nov 28, 2003
    #2
    1. Advertisements

  3. (chirs) writes:

    > 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
    --
    Lasse Reichstein Nielsen -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Nov 28, 2003
    #3
  4. chirs

    chirs Guest

    Lee <> wrote in message news:<>...
    > 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?


    You are right, I did not put return.
     
    chirs, Nov 29, 2003
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wayne
    Replies:
    1
    Views:
    97
  2. Replies:
    11
    Views:
    334
    Thomas 'PointedEars' Lahn
    Dec 11, 2006
  3. Replies:
    0
    Views:
    134
  4. Replies:
    7
    Views:
    257
  5. Moses
    Replies:
    3
    Views:
    233
Loading...

Share This Page