topical media & game development
#javascript-code-16-click.js / js
// Find all <a> elements within the document
var a = document.getElementsByTagName(“a”);
for ( var i = 0; i < a.length; i++ ) {
// If the link points to the same page that we’re currently on
if ( a[i].href == window.location.href ) {
// Make it such that the link no longer ‘works’ when clicked
a[i].onclick = function(e){
return false;
};
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.