Tom*_*ing 7 internet-explorer svg vml internet-explorer-8 internet-explorer-9
我正在我的ASP.NET Web应用程序中绘制形状.在IE9和其他浏览器中,我正在使用SVG,它工作得很好.在IE8及以下版本中,我使用的是VML.我发现当它处于IE8标准模式(不使用兼容性视图)时,IE8根本不显示VML.
我的doctype设置为<!DOCTYPE html>.如果我参加了doctype走完全,IE8进入怪癖模式和工作正常,但IE9然后去它的怪癖模式(而不是IE9标准),并且不显示SVG.
这是在测试页面上发生的,因此除了包含div的表单之外没有任何内容,div包含<svg>元素及其子元素或VML元素.
这里发生了什么?看起来我不应该为不同的浏览器更改doctype,而且Stack Exchange用户页面上的信誉图看起来也是一样的(IE8及以下的VML,其他人的SVG,HTML5 doctype)......
小智 5
还有一些事情你需要检查:
需要修改行为规则的选择器.
.
var vmlFrag = document.createDocumentFragment();
vmlFrag.insertAdjacentHTML('beforeEnd',
'<v:rect id="aRect" fillcolor="red"
style="top:15px;left:20px;width:50px;height:30px;position:absolute;"></v:rect>'
);
document.body.appendChild(vmlFrag);
Run Code Online (Sandbox Code Playgroud)
.
var aRect = document.getElementById('aRect');
aRect.outerHTML = aRect.outerHTML;
Run Code Online (Sandbox Code Playgroud)
要在 IE8 标准模式下声明 VML 命名空间,您需要包含第三个'#default#VML'参数:
document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML');
Run Code Online (Sandbox Code Playgroud)
您可能需要注意 IE8 中 VML 的其他更改。
| 归档时间: |
|
| 查看次数: |
8730 次 |
| 最近记录: |