我有以下代码:
var d = document.createElement("div");
d.id = "d_1";
d.style.backgroundImage = "url(img/lr.png");
d.style.backgroundRepeat = "no-repeat";
d.style.width = "150px";
d.style.height = "25px";
d.style.position = "absolute";
d.style.left = "460px";
d.style.top = "385px";
d.style.visibility = "visible";
document.documentElement.appendChild(d);
那个 div 不显示在 Opera 和 Chrome 中,但它显示在 firefox 中!
怎么了?
最佳答案
语法错误。
d.style.backgroundImage = "url(img/lr.png");
应该是
d.style.backgroundImage = "url(img/lr.png)";
关于javascript - 可见性的 CSS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3968896/