【问题标题】:printing VML in IE8在 IE8 中打印 VML
【发布时间】:2012-07-06 08:04:55
【问题描述】:

这是一个非常简单的 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;">

【问题讨论】:

  • 我注意到完全删除 doctype 可以解决这个问题,但这不是一个很好的解决方案,因为 my 被广泛使用...

标签: javascript printing internet-explorer-8 vml


【解决方案1】:

您必须在 document.namespaces.add 中添加第三个参数:

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

【讨论】:

    猜你喜欢
    • 2010-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多