I have no idea if this was the best way, but if you use jquery you can do something like this:
var hoveringOver = false; $("a#myLink").bind("mouseenter", function(){ hoveringOver = true; }); $("a#myLink").bind("mouseleave", function(){ hoveringOver = false; }); function isHoveringOver(){ return hoveringOver; }
source share