在 IE8 中打印 VML



这是一个非常简单的VML示例,在所有版本的IE上都能很好地显示。它还可以在除IE8以外的所有版本的IE上打印。我知道可以使IE8打印VML,但找不到我应该怎么做。感谢您的任何提示。

    <script type="text/javascript">
        window.onload = function ()
        {
            document.createStyleSheet().cssText = 'v\:oval { behavior:url(#default#VML); display: inline-block}';                              
            document.namespaces.add('v', 'urn:schemas-microsoft-com:vml');
            var node = document.createElement("<v:oval>");
            node.style.width = "100px";
            node.style.height = "100px";                
            document.getElementById("mydiv").appendChild(node);  
        }
    </script>
    <div id="mydiv" style="background-color:#eeeeee; width: 800px; height: 620px;">

您必须将第三个参数添加到 document.namespaces.add:

 document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML');

最新更新