当用户单击图片时,我该如何交换图片的SRC属性?
<a href="#">
<img src="./layout/images/search.png" />
</a>
$('img[src="./layout/images/search.png"]').click(function () {
$(this).attr('src',"./layout/images/search_select.png")
});
$("img").click(function(){
$(this).attr("src","new.gif");
})
$("img[src='old.gif']").click(function (){
$(this).attr("src","new.gif");
})
$('.swap').click(function(){
$(this).attr('src','new/path/to/img.jpg');
});