I have this code to give me a rollover on submit buttons, and I\'m trying to make it more generic:
$(\'.rollover\').hover(
function(){ // Change
You should be able to use a regex replace to modify your source path. Like this:
srcPathOver = srcPath.replace(/([^.]*)\.(.*)/, "$1-over.$2");
More on JavaScript regexes here
As far as how you're doing it, I'd make sure that you define your srcPath variable like this
var srcPath;
$('.rollover').hover(...
The code you have above makes it look like srcPath is a global variable, which is not what you want.