3 ms·
If you want to retain IE6 compatibility (usually a must for government related sites!), I've found this technique is pretty solid for cross browser platform com
by plasma 16y ago
If you want to retain IE6 compatibility (usually a must for government related sites!), I've found this technique is pretty solid for cross browser platform compatibility (IE6-9, FF, Chrome, Safari):
<a href="#" onclick="DoSomething(); return false;">My link</a>
1) When you hover over the link, a 'hand' cursor appears for every browser (due to the #)
2) IE6 (in particular) won't barf at running your javascript code found in the onclick handler.
If your href tag contained "javascript:void(0)" instead of "#"; your code may not be run under IE6.
3) Because you 'return false' on the onclick, all browsers still avoid leaving the customers web browser with an unnecessary # in the top of the Url bar (as the click is effectively cancelled).