You can access the element from js to add an onclick event:
Your button (or link, or div or what ever):
<input type="button" value="Click me" id="button" />
Native javascript:
document.getElementById('button').onclick=function () {
// Do your magic here
};
Or with jQuery:
$('#button').click(function () {
// Do your magic
});
You can also access the object by class, or by its parent or by its content, not just id.
Example: http://jsfiddle.net/N8j8p/