本帖最后由 idragonet 于 2012-11-02 09:35:35 编辑

解决方案 »

  1.   

    你选择的链接还是图片??看你选择的就是链接$('a').attr('href','http://163.com');$('img').parent().attr('href','http://163.com');
      

  2.   

    通过parentNode获得父节点  这里就是获得A标签的节点  然后再设置...
      

  3.   

    搞定了!原来用错了:
    this.parent()。。
    $("img[src$='x40.jpg']").each(function(){  
        //  alert(this.src);
      var href=this.src.replace("_40x40.jpg",""); 
      $(this).parent().attr('href',href);
      $(this).parent().attr('target','_blank');
    });