There are several ways to do this. In your case, the simplest is probably the following:
define doprocess2 as follows:
function doprocess2(e) { e.stopPropagation && e.stopPropagation() || (e.cancelBubble = true); ... }
and name it as follows:
onclick="doprocess2(event);"
This will work in all modern browsers, as well as ie6, ie7 and ie8
Here is an example:
<html> <head> <script> function doprocess1() { alert('tr'); } function doprocess2(e) { e.stopPropagation && e.stopPropagation() || (e.cancelBubble = true); alert('td'); } </script> </head> <body> <table> <tr onclick="doprocess1();"> <td>click tr</td> <td><button onclick="doprocess2(event);">click td only</button></td> </tr> </table> </body> </html>
source share