首页 > jquery load后调用函数的问题

jquery load后调用函数的问题

这么写就OK(远程调用一段广告后把广告图片设置成100%宽度)

$("<div class='ajax_a' id='g2'></div>").appendTo($('.post:eq(5)')).load("/atextad/ad.html .sct1:eq(6)", function() {
                $(this).find("img").css({
                    width: '100%',
                    marginTop: "10px"
                });
            });

但是下面这两种就不行

$("<div class='ajax_a' id='g2'></div>").appendTo($('.post:eq(5)')).load("/atextad/ad.html .sct1:eq(6)", (function(argument) {
                return findimg_set100(argument)
            })($(this)));
$("<div class='ajax_a' id='g2'></div>").appendTo($('.post:eq(5)')).load("/atextad/ad.html .sct1:eq(6)", findimg_set100($(this)));

这是函数

function findimg_set100(jelem) {
    alert(jelem.find("img").size())
        //----------------输出0
    jelem.find("img").css({
        width: '100%',
        // marginTop: "10px"
    });
}

function findimg_set100(jelem) {
    $(jelem).find("img").css({
        width: '100%',
        // marginTop: "10px"
    });
}
【热门文章】
【热门文章】