Here are some good notes when you using event on anchor tag in JavaScript:
JavaScript pseudo-protocol – Awful!
<a href=”javascript:window.open(‘help.html’)”>contextual help</a>
Pointless link – Bad!
<a href=”#” onclick=”window.open(‘help.html’); return false;”>contextual help</a>
Using the DOM – Better.
<a href=”help.html” onclick=”window.open(this.getAttribute(‘href’)); return false;”>contextual help</a>
No inline JavaScript – Best!
<a href=”help.html” class=”help”>contextual help</a>
Comments 0