好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

求教一个问题_html/css_WEB-ITnose

$(".pe_xgtxB_r span").css("style","background:url("+json.path+'190x190'+json.localName+") no-repeat");
为什么没法给这个SPAN导这个图片了json.path+'190x190'+json.localName拼出来是我图片的位置


回复讨论(解决方案)


请单独定义拼接路径

var newUrl= json.path+'190x190'+json.localName;alert(newUrl);$(".pe_xgtxB_r span").css("background-image", newUrl); 

$(".pe_xgtxB_r span").attr("style","background:url("+json.path+'190x190'+json.localName+") no-repeat");
或者
$(".pe_xgtxB_r span").css({"background-image":"url("+json.path+'190x190'+json.localName+")","background-repeat":"no-repeat"});

1楼2楼都好使

查看更多关于求教一个问题_html/css_WEB-ITnose的详细内容...

  阅读:41次