Created
July 17, 2009 21:24
-
-
Save bjartek/149285 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<a href="rat">rat</a> | |
<a href="donkey">doneky</a> | |
<script type="text/javascript"> | |
var anchors = document.getElementsByTagName("a"); | |
console.log("foobar"); | |
for(var i = 0; i < anchors.length; i++) { | |
var a = anchors[i]; | |
a.onclick = function(el) { | |
alert(this.getAttribute("href")); | |
return false; | |
}; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment