Snetty
10-10-2006, 03:05 AM
Ok, firstly I'm totally new to JS but I've been reading up a bit on various things and I think that it's possible to use nodes to set onclick='if(this.blur)this.blur()' for all links without actually entering it in the html every singe time (which tbh, I keep forgetting to do).
I've written the following code.. which surprise surprise doesn't work (but also doesn't give me any errors)
<script language='Javascript' type='text/javascript'>
startList = function() {
for (i=0; i<document.body.childNodes.length; i++) {
node = document.body.childNodes[i];
if (node.nodeName=="a") {
node.onfocus="if(this.blur)this.blur();";
}
}
}
window.onload=startList;
</script>
Does anyone think that they can point me in the right direction?
I've written the following code.. which surprise surprise doesn't work (but also doesn't give me any errors)
<script language='Javascript' type='text/javascript'>
startList = function() {
for (i=0; i<document.body.childNodes.length; i++) {
node = document.body.childNodes[i];
if (node.nodeName=="a") {
node.onfocus="if(this.blur)this.blur();";
}
}
}
window.onload=startList;
</script>
Does anyone think that they can point me in the right direction?