使用 IE 8,我试图通过 javascript 添加两个 VML 椭圆(A,B)到我的页面。无论哪个椭圆附加到父 DIV 都会被渲染,但第二个不是。
如果我 appendChild(A) 然后 appendChild(B),椭圆 A 被渲染,B 不是。如果我 appendChild(B) 然后 appendChild(A),椭圆 B 被渲染,A 不是。
document.namespaces.add("v","urn:schemas-microsoft-com:vml");
this.container = Document.getElementById(mydiv);
var grid2 = document.createElement("v:oval");
grid2.style.left= "300px";
grid2.style.top= "250px";
grid2.style.width= "25pt";
grid2.style.height= "75pt";
grid2.style.position="absolute";
grid2.style.behavior="url(#default#VML)";
grid2.style.display="inline-block";
grid2.setAttribute("fillcolor","#FF0000");
grid2.setAttribute("id", "marker2");
var grid = document.createElement("v:oval");
grid.style.left="100px";
grid.style.top="100px";
grid.style.width="94pt";
grid.style.height="164pt";
grid.style.position="absolute";
grid.style.behavior="url(#default#VML)";
grid.style.display="inline-block";
grid.setAttribute("fillcolor","#0000FF");
grid.setAttribute("id", "marker");
this.container.appendChild(grid2);
this.container.appendChild(grid);
我错过了添加 VML 的一些技巧吗?
我已经在 IE 9 中尝试过,结果相同。
由于公司规定,公司内部只支持IE,而且很多用户还在用IE8,所以暂时不能切换HTML5 Canvas。
感谢您的任何建议