Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Differentiate between user caused events and script generated events

Reply
Thread Tools

Differentiate between user caused events and script generated events

 
 
jmpinchot@gmail.com
Guest
Posts: n/a
 
      04-27-2007
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()?

 
Reply With Quote
 
 
 
 
Peter Michaux
Guest
Posts: n/a
 
      04-27-2007
On Apr 26, 5:27 pm, (E-Mail Removed) wrote:
> 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()?


I don't think so.

You could do this

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

handleClick(false);
</script>

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

Peter

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
onbeforeunload : differentiate between different events rhitam Javascript 1 05-13-2009 10:34 PM
Differentiate between static and dynamic allocated objects Jo C++ 7 12-28-2006 11:19 AM
A Plea: Differentiate between Lens Chromatic Aberration and Sensor Chromatic Abbertion digiboy Digital Photography 3 12-06-2004 07:25 AM
How to differentiate between <XX></XX> and <XX/> with SAX dpj5754@yahoo.fr XML 13 08-11-2004 12:02 AM
How to differentiate PDA user and pc user by checking version of browser? KingBEE ASP .Net Web Controls 0 04-03-2004 05:11 AM



Advertisments