Testing if javascript runs in post
Testing to see if javascript will run after the break (read more) so I can load a javascript file and css at the same time.
If the javascript runs after the break, then I’ll be able to change/load CSS for highlighting html demos, etc. In this example I’m loading a css file and javascript file to change the syntax color for the javascipt code below.
Testing run now.
/*
This script detects external links in a page
and attaches a behaviour to them so they open
in a external window.
*/
function initialiseLinks() {
if (document.getElementsByTagName) {
var links = document.getElementsByTagName("A");
for (var i = 0; i < links.length; i++) {
if (links[i].href.indexOf("http:")==0) {
// if the links URL starts with http: then we assume it's an external link
links[i].onclick = function() {
window.open(this.href);
return false; // stop normal link behaviour
}
}
}
}
}
window.onload = initialiseLinks();