Differentiate between user caused events and script generated events

Discussion in 'Javascript' started by jmpinchot, Apr 27, 2007.

  1. jmpinchot

    jmpinchot Guest

    Is it possible for an onclick handler for an element to tell the
    difference between a click event that was caused by a mouse click or a
    click event generated by calling document.getElementByID('id').click()?
    jmpinchot, Apr 27, 2007
    1. Advertisements

  2. I don't think so.

    You could do this

    <script type="text/javascript">
    function handleClick(isRealMouseClick) {


    <div onclick="handleClick(true);">click me</div>

    Peter Michaux, Apr 27, 2007
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.