onClick vs. onDblClick


is there a way to do something only once (onClick-event), even if the user performs a double-click? To ignore the onClick if the event is a double click? Or at least to trigger it only once? I set an onClick-event-handler as well as an onDblClick-handler:

    myTree.attachEvent( “onDragIn”, mt_onDragIn );

    myTree.attachEvent( “onClick”, mt_onClick );

    myTree.attachEvent( “onDblClick”, info_onDblClick );

    myTree.attachEvent( “onXLE”, mt_onXLE );

    myTree.attachEvent( “onDrag”, mt_onDrag );

and mt_onClick() is called twice in case the user double clicks

This is caused by browser nature , in case of dblclick browser always generate onclick event and only after it dblclick event generated, there is no stable way to separate “true onclick” and “onclick” generated in case of dblclick.

As possible solutions you can add timeouts inside your code and drop onclick timer if ondblclick event will be fired in small amount of time.