我有问题获取一个div的背景URL背景图片的问题与JavaScript
HTML:
<div id='test'></div>
CSS:
#test { position:absolute; height:55px; width:85px; top:554px; left:197px; background:url('images/1.jpg'); }
当我试图让背景通过使用下面的图像网址显示空白。
alert(document.getElementById("test").style.backgroundImage);
但有趣的是它适用于以下
document.getElementById("test").style.backgroundImage="url('images/1.jpg')";
alert(document.getElementById("test").style.backgroundImage);
注:没有与URL的问题,因为图像正常显示