Home  >  Article  >  Web Front-end  >  求教一个问题_html/css_WEB-ITnose

求教一个问题_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:42:43999browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn