inline javascript in href
Just put the JS code directly in there:
<a href="#" onclick="a=1;b=2; return false;">fsljk</a>
Though, you should not be doing inline scripting. You should unobtrusively attach event handlers.
<a id="lol" href="/blah">fdsj</a>
<script>
document.getElementById('lol').onclick=function() {
/* code */
};
</script>
<a href="javascript:var hi = 3;" >myLink</a>
Now you can use hi
anywhere to get 3
.