When you want to create a NULL link, do not use #.
Netscape and Internet Explorer 5 see the pound character (#) as a named anchor on the same page. The browsers start searching for the named anchor at the top of the page. When the named anchor is not found, the browsers stop at the top of the page.
Use the following: javascript:; or javascript:void(0). Problem solved.
Nate brought to my attention that Scott Andrew says not to use javascript. That it’s depreciated. That we should at least provide a noscript alternative.
I dunno about that in this case. Because in this case we are trying to provide a null link without the stupid browser anchoring to the top of the page. In this instance, we’re just using javascript to NULL this link. If they don’t have javascript enabled, nothing will still happen. Which was the point.
As for providing NOSCRIPT alternatives? That I agree with. For the most part. IF what you’re trying to provide is critical to the site, and if it requires javascript, then provide a noscript. Otherwise, you have the luxury of balancing the potential loss of usability for that 5% or less (generally what I’ve found my non-javascripting users) against the extra work of providing that noscript alternative.
Tagged As Coding, HTML, Javascript, Reference
Comments are Open (0)
Posted at 12:00 PM