Modifying the onClick value in javascript

I was trying to figure out an easy way of changing the onclick value of a click-able element in a project I’m working on and found this solution — so incredibly simple, and it works in Safari, FF and IE…

document.getElementById(‘clickable-element-id’).onclick = function() {functionname(parameterlist);};