First of all, is that an HTML button, or a Java Applet button.

Regardless, neither have anything that corresponds to a double click. In the
context of a button, a double click doesn't really mean anything - so there is
no OnDoubleClick() or similar handler.

However, one of the easiest things to do would be to set a flag that indicates
if the button has been clicked or not.

If you are talking about an HTML form button, I guess you are using a SUBMIT
input element.

Instead, you could use a BUTTON element that calls a JavaScript function that
will submit the form only if the flag is not set.

For example,

<HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function SubmitForm()
    {
        if(bSubmitted==false)
        {
            bSubmitted=true;
            document.forms[0].submit();
        }
        else
        {
            alert("I told you not to click twice!!! Go and buy AOL for
Dummies");
            document.location="http://www.amazon.com";
        }
    }
    </SCRIPT>
</HEAD>


<BODY OnLoad="bSubmitted=false">
    <FORM ACTION="servlet_url">
        <INPUT TYPE="Button" VALUE="Click Me" OnClick="SubmitForm()">
    </FORM>
</BODY>



Jack wrote:

> I created a button that would call a servlet.
>
> How can I prevent the user to double click the button that will
> call the servlet twice?
>
> Thanks.
>
> Jack
> [EMAIL PROTECTED]
> ====================================================
> Making Money: Click below.
> http://www.gotoworld.com/getpaid/default.asp?rid=1013102248
> ====================================================
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

--

____________________________________________________________

V i h u n g   M a r a t h e    http://www.marathe.net/vihung
____________________________________________________________

E-Mail:  [EMAIL PROTECTED]                   On the Move
Voice Mail:  (650) 618-1586
Fax:         (650) 618-1586
____________________________________________________________

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to