href and javascript function()

Today was a nice challenge day, as you all well know javascript is not logic, is pure imagination. I had problems in putting a javascript code into the href instead of using onclick because sometimes sharepoint overwrite it, just because it doesn't make sense. Here is why: you need to put brackets everywhere.
javascript:(function(){alert('test')})()
So in real life it will be:
 alert 

0 comments :: href and javascript function()