Also I need the script to use a regular expression and trim the src before it can append the string.
so the current image would be like ( I am using drupal too ).
<img src="/sites/default/files/Person.jpg?61289291" />
I need to trim all the garbage off of the end and make it
<img src="/sites/default/files/Person_silly.jpg" />
and then on hover out it goes back to normal
I ran this script on my local server and it works, but that does not involve the garbage that drupal adds, and when run on the real server it trims the whole source to _silly.jpg instead of appending it.
<script type="text/javascript">
$(document).ready(function() {
$("img.imagefield")
.mouseover(function() {
var src = $(this).attr("src").match(/[^\.]+/) + "_silly.jpg";
$(this).attr("src", src);
})
.mouseout(function() {
var src = $(this).attr("src").replace("_silly", "");
$(this).attr("src", src);
});
});
</script>

New Topic/Question
Reply



MultiQuote



|