日期:2014-05-18  浏览次数:20509 次

js获得背景图片
如题,我想用JavaScript获得一个层的背景图片,然后根据背景图片进行操作,请问该如何获得?

------解决方案--------------------
JScript code
 var bimgurl = document.getElementById("div111").style.backgroundImage;
 bimgurl = bimgurl.replace('url(','').replace(')','');
 alert(bimgurl);

------解决方案--------------------
var bimgurl = document.getElementById("div111").style.backgroundImage;
 bimgurl = bimgurl.replace('url(','').replace(')','');
 alert(bimgurl);
------解决方案--------------------
document.getElementById("div_background").style.backgroundImage.replace("url(","").replace(")",""); 

------解决方案--------------------
up
------解决方案--------------------
up