Heim  >  Artikel  >  Web-Frontend  >  求教一个问题_html/css_WEB-ITnose

求教一个问题_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:42:43994Durchsuche

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn