This would do the trick:
    $(function() {
        $('.nav a img').hover(
            function() {
                this.src = this.src.replace( /\.gif$/, '_on.gif' );
            },
            function() {
                this.src = this.src.replace( /_on\.gif$/, '.gif' );
            }
        );
    });
-Mike


  _____  

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Glen Lipka
Sent: Wednesday, December 12, 2007 10:49 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Img Src replacement


I have a nav that I do not control the HTML Source.

<div class="nav">
  <a href="foo.htm"><img src="foo.gif" /></a> 
  <a href="bar.htm"><img src="bar.gif" /></a>
</div>

I want to have a hover event applied to the IMG so that when you hover over
the img src changes from foo.gif to foo_on.gif and bar.gif to bar_on.gif.

How do you do that replace hover?

Glen


Reply via email to