Un-tested, but maybe something like this:

if ($.browser.msie && $.browser.version == '6.0') {
     $("img").each(function() {
          var new_src = $(this).attr("src").replace(/.png$/i, '.jpg');
          $(this).attr("src", new_src);
     });
}

Note that $.browser is deprecated from jQuery 1.3, but still available
for use.

On Feb 10, 3:26 pm, -e-train <etrai...@gmail.com> wrote:
> Hi All,
>
> I am new to jQuery and am having a hard time figuring out what i am
> looking for in the docs an don this forum.
>
> What i want to do is create a little jquery script that checks to see
> if the browser is msie and browser.version is 6.0
>
> I have that part done:
>
> jQuery.each(jQuery.browser, function(i, val) {
>         if(i=="msie" && jQuery.browser.version.substr(0,3)=="6.0") {
>                 }
>         }
>
> });
>
> I was able to display an alert. cool.
>
> now what I would like to do is if the above is true and the agent is
> msie 6.0
>
> then i want to find all <img> tags that have a src="some-image.png"
> and replace the ".png" with ".jpg"
>
> i think i need to use the [attribute$=value] selector.
> and then write something that is the equivalent of
> if ("img[source$='png']")
> then replace ("img[source$='png']") with ("img[source$='jpg']")
>
> but i don't know how to write javascript very well...
>
> any help is appreciated.
> cheers,
> -e-

Reply via email to