<h2>JavaScript?</h2>
<p>JavaScript is user side scription language</p>
<h3>onclick vs href</h3>
<p>Be smart or die trying, a story by me about how I manage to remove inline codes in the best possible way</p>
<p>Please visit <a href='http://adactio.com/atmedia2005/' title='The Behaviour Layer: Using JavaScript for good, not evil'><strong>http://adactio.com/atmedia2005/</strong></a></p>
<pre>
<a href="javascript:window.open('page.html')">my page</a> Awful!
<a href="#" onclick="window.open('page.html')">my page</a> Bad!
<a href="page.html" onclick="window.open(this.href)">my page</a> Better
<a href="page.html" class="popup">my page</a> Best!
function doPopups() {
if (!document.getElementsByTagName) return false;
var links = document.getElementsByTagName("a");
for (var i=0; i < links.length; i++) {
if (links[i].className.match("popup")) {
links[i].onclick = function() {
window.open(this.href);
return false;
}
}
}
}
window.onload = doPopups;
</pre>
<h4>See also</h4>
<ul>
<li><a href='http://www.robertnyman.com/2006/03/23/ajax-javascript-and-accessibility/' title='Robert Numan - Ajax Javascript and Accessibility'>Robert Numan</a></li>
<li><a href='http://warpspire.com/journal/web-production/ajax-tamed-where-html-and-the-dom-meet/' title='Where HTML and DOM meet'>WarpSpire - Where HTML and DOM Meet</a></li>
</ul>;2;1
.info
.org