Javascript : scrollIntoView()

There are two things I hate most in web development; Javascript and Internet Explorer. A stupid amount of my time is wasted trying to find hacks for Internet Explorer. I spent a month trying to fix this annoying little problem. IE for some reason, would not allow anchor links to work in tabs using jQuery after the database has been updated. It was a tiny little problem that I couldnt solve, then I found this one line solution.

<a onClick=”document.getElementById(‘linkName’).scrollIntoView();” style=”cursor: pointer;”>Link Name</a>

 

This scrolls down to your anchor link be it in Firefox or Internet Explorer. The style above gives it the right cursor so it looks like a hyper-link.