document.getElementById("bg_image").style.backgroundImage =
"url('http://amigo.com/300107-2853.jpg')";
表面上看结果很完美,
但是我却无法做到同样的事情:
document.getElementById("bg_image").style.backgroundImage =
"url('data:image/png;base64,iVBORw0KGgoAAAAAAAAyCAYAAAAUYybjAAAgAElE...')";
也不
document.getElementById("bg_image").style.backgroundImage =
"data:image/png;base64,iVBORw0KGgoAAAAAAAAyCAYAAAAUYybjAAAgAElE...";
有没有办法做到这一点?
url('
should work, my problem was that the ActionScript dataURL actually had newlines, and I had toreplace(/\n/g, '')
- neaumusicyourimageelement.setAttribute('style', 'background-image:url('+ yourbase64data +')');
- Hanna Rose