bad: id = "myLink" href = "javascript:MyFunction();" > link text good: id = "myLink" href = "#" onclick = " MyFunction (); " > link text better: id = "myLink" href = "#" onclick = " MyFunction (); return false ; " > link text even better 1: id = "myLink" title = "Click to do something" href = "#" onclick = " MyFunction (); return false ; " > link text even better 2: id = "myLink" title = "Click to do something" href = "PleaseEnableJavascript.html" onclick = " MyFunction (); return false ; " > link text Why better? because return false will prevent browser from following the link best: Use jQuery or other similar framework to attach onclick handler by element's ID. $ ( '#myLink' ). click ( function (){ MyFunction (); return false ; }); $ ( 'a' )....
A foundation you can build.