Archive for June, 2009

Replace img link via jquery

June 25, 2009

This code will find all img tags  in the page that point to the image _layouts/images/gosearch.gif and replace it with another link.

<script src=”http://code.jquery.com/jquery-latest.js”></script>
 <script>
$(document).ready(function() {
$(“img[src*=’_layouts/images/gosearch.gif’]”).attr(‘src’, ‘_layouts/images/newicon.gif’);
$(“img[onmouseover*=’/_layouts/images/gosearch.gif’]”).attr(‘onmouseover’“this.src=’_layouts/images/newicon.gif'”);

$(“img[onmouseout*=’/_layouts/images/gosearch.gif’]”).attr(‘onmouseout’, “this.src=’_layouts/images/newicon.gif'”);
});
Advertisements