首頁  >  文章  >  web前端  >  求教一个问题_html/css_WEB-ITnose

求教一个问题_html/css_WEB-ITnose

WBOY
WBOY原創
2016-06-24 11:42:43994瀏覽

$(".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楼都好使

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn