ERROR:href=”#” shifting the brower scroll on top…!
javascript April 11th, 2008Have you people ever noticed that for a hyperlink of type
<a href=“#”>test</a>
after clicking causes the window scroll position to move upwards giving a weird sense of behaviour to the link.
I just managed to find out a workaround for this problem.What I did was I re-coded the hyperlink in the following manner
<a href=“javascript:void(0);” >test</a>
Here I am doing nothing but replacing the # with a null javascript, but here I have to assume that the javascript in your friendly browser is enabled.
Another work around is
<a href=“#” onclick=“javascript:alert(’test’);return false;”>test</a>
here the return false tell the browser to do nothing once the alert is displayed.








