I’ve been using this function for a while now, and thought I’d share it.
// swaps image.gif
// for image2.gif
// and vice versa
function swapThisImage(oElement){
imageSource = oElement.src;
arrayParts = imageSource.split(’.');
var extension = arrayParts.pop();
var path = arrayParts.join(’.');
if(imageSource.lastIndexOf(’2.’) > 1) {
path = path.substring(0,path.length-1)
oElement.src = path + ‘.’ + extension;
} else {
oElement.src = path + ‘2.’ + extension;
}
}
To call the function just [...]
Neat little javascript image swap function
Wordpress and .htaccess
I’ve just ported a few articles over from the old site to give the site a bit of a starting point, some of them aren’t particularly well written in both their grammar and their code but hey it’s a start.
Over the years the old site had built up a steady trickle of visitors from its [...]
PHP Output Caching Class
A simple class for output caching with PHP.
<?php
/*
_________
| INFO |__________________________________________________________________
| [...]