Yo, I solved it using .attr (http://is.gd/tG1X) I should have remembered .attr to be fair.
This script takes some images from a folder and displays them on a page (as greyscale), with rollover replacement images from another folder (full colour versions).: <?php // get template directory (wordpress) $templateDir = get_bloginfo(template_directory); // get current directory getcwd(); // change to directory we want chdir('wp-content\themes\ldexterldesign\images\logos\accreditors \hoverOff'); // make a variable of the path $cwd = getcwd(); // get all the filenames $files = scandir($cwd); // count total files in directory $totalFiles = count($files); // get end directory from the $cwd $endDirectory = explode('\\', $templateDir); // spit out the filenames with img tag HTML echo '<ul id="accreditors">'; for($i = 1; $i <= $totalFiles-1; $i++){ echo '<li>'; echo '<a href="#">'; echo '<img src="'; echo $templateDir; echo '/images/logos/accreditors/hoverOff/'; echo $files[$i]; echo '"/>'; echo '</a>'; echo '</li>'; } echo '</ul>'; ?> <!-- footer logo rollover state changes --> <script type="text/javascript"> $(document).ready(function() { $("#accreditors img").hover( function() { // get img src this.oldSrc = $(this).attr('src'); // reference the hoverOn directory instead of the hoverOff directory and reflect in the url this.newSrc = this.oldSrc.replace('hoverOff', 'hoverOn'); // change image source on hover $(this).attr('src', this.newSrc); } , function() { $(this).attr('src', this.oldSrc); } ); } ); </script> Thanks (You too Charlie!) L On Apr 21, 2:50 pm, ldexterldesign <m...@ldexterldesign.co.uk> wrote: > Hey guys, > > I have a image rollover I need to do through JS (I don't think it's > going to be possible through straight forward CSS. The practicality is > I'll have to put an extra class on all the images to make them > reference'able) > > I have this: > > $(document).ready(function() { > $("#accreditors a").hover( function() { > // change part of the url path;}, > function() { > // revert the url path back to normal;} > ); } > ); > > Any tips or functions you can throw my way, or will I have to go at it > and handle the string? > > Thanks, > L