html代码:
<dl id="store_type">
  <dt>name11<img src="images/up.jpg" /></dt>
  <dd><a href="#" target="_blank" >name22</a></dd>
</dl>js代码:$(document).ready(function() {

$('#store_type').find('dd').show().end().find('dt').click(function() {
         var answer = $(this).next();
         if (answer.is(':hidden')) { 
             answer.slideDown();
         } else {
             answer.slideUp("fast",function(){
answer.find('img').attr(src, "images/down.jpg");
    });          }
     });
});
我想在answer.slideUp()的时候,把<dt>中的图片换成images/down.jpg,
应该是answer.find('img')这个地方有错误,但又不知道是什么错误,已经困扰我一晚上了,
查了半天资料,也没找到,希望高手帮忙解答下,万分感谢!

解决方案 »

  1.   


    answer.find('img').attr(src, "images/down.jpg");
    换成
    answer.prev().find('img').attr("src", "images/down.jpg");
      

  2.   


        $('#store_type').find('dd').show().end().find('dt').click(function() {
             var answer = $(this).next();
             if(answer.is(':hidden')){ 
                 answer.slideDown();
             }else{
      answer.slideUp("fast",function(){
             $(this).parent().find('img').attr('src',"images/down.jpg");
    }); 
             }
         });
      

  3.   


     answer.find('img').attr("src", "images/down.jpg");