check for the mouse button in the click event by using the event property
$('#element').click(function(event) {
    if  (event.which==3) {
            alert('Right mouse button pressed');
            break;
    }
});
for more options read this
for using jquery you have to include the jquery library in your head tag 
<script type="text/javascript" src="jquery library path which you can download from jquery site or use google jquery library"></script> 
the you have to use another <script> tag for writing you jquery 
<script type="text/javascript"></script>
$(document).ready(function(){
$('#element').click(function(event) {
        if  (event.which==3) {
                alert('Right mouse button pressed');
                break;
        }
    });
});
<script type="text/javascript">
</script>
for more detail read jquery documentation, do a little google