You need to stop the browser from doing it’s default action.
<a href="#" onclick="IDClick(id);event.preventDefault();">id</a>
When you click on a link, the default action is to go to that address. event.preventDefault(); prevents the browser from doing the default action.
This is a significantly better solution for accessibility. Quoting @aij’s comment above: “using CSS makes it look ok, but still leaves it inaccessible from the keyboard (ie, tab will never focus the link)”.