edit oops is "src" for tags <img>, not "href"
Well, you can get the url:
var imgUrl = $('#imageId').attr('src');
Once you get this, you can add "_hover" with:
imgUrl = imgUrl.replace(/^(.*)\.png$/, "$1_hover.png");
and delete it with
imgUrl = imgUrl.replace(/_hover\.png/, '.png');
, :
$('#imageId').hover(
function() {
var $img = $(this);
if (!/_hover\.png$/.test($img.attr('src')))
$img.attr('src', $img.attr('src').replace(/^(.*)\.png$/, '$1_hover.png');
},
function() {
var $img = $(this);
$img.attr('src', $img.attr('src').replace(/_hover\.png$/, '.png');
}
);
, "foo_hover_hover.png".