What is this JavaScript code doing here, specifically the while loop:
function setAjaxLinks(){
var links = document.body.getElementsByTagName("a");
var linkL = links.length;
while (linkL--) {
if (!links[linkL].href.match('#')) {
mj.pageLoad(links[linkL]);
}
}
}
I’m aware “mj” doesn’t really mean anything, but what is the general gist?
It loops through all links (a-tags) on the page from the last to the first (decrementing).
If it finds a link that doesn’t have a
#symbol in it, it calls themj.pageLoadfunction with the link in question as parameter.Here’s a blow by blow: