is there anyway of distinguishing between whether the button is clicked directly by a mouse or its click event has been triggered logically?

<input type="button" id="someID" value="dene" onclick="alert('something');" />

<input type="button" value="dene2" id ="someID2" onclick="document.getElementById('someID').click()" />

now guys i want some kind of thing : when you directly click on someID button, it wont do anything, but when you click on someID2 button, it will alert.

I deadly need this. please help.
thanks

i found it guys, here is the complete example, when you click the button, it will give you 0, when you click it with mouse it will give you 1 and when you click with mouse right button it will give you 2.

<html>
<head>


</head>

<body>

<script type="text/javascript">

//link and form elements do not need to be told to capture.
//Using the JavaScript syntax, we have to wait for the relevant
//part of the page to load before telling it to detect the event
//This is easiest done with a load event listener
window.onload = function () { document.links[0].onmousedown=alertBut; }

function alertBut( e, evElement ) {
  if( !e ) {
    if( window.event ) {
      //Internet Explorer
      e = window.event;
    } else {
      //total failure, we have no way of referencing the event
      return;
    }
  }
  if( typeof( e.which ) == 'number' ) {
    //Netscape compatible
    e = e.which;
  } else if( typeof( e.button ) == 'number' ) {
    //DOM
    e = e.button;
  } else {
    //total failure, we have no way of obtaining the button
    return;
  }
  if( !evElement ) { evElement = this; }
  /* 'this' will exist if I have used object.onEventName = alertBut;
  If I have passed evElement from the onmouseup attribute,
  'this' will refer to window */
  window.alert( evElement + ' was clicked with button ' + e );
}

</script>

<a  id ="someID" onmouseup="alertBut(arguments[0],this)" href="whatever">dene bakalim</a>
    <input id="Button1" type="button" value="button" onclick="document.getElementById('someID').onmouseup();" />
</body>
</html>

the script part is taken from http://www.howtocreate.co.uk/tutorials/javascript/eventinfo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.