Cufon IE无效参数

时间:2011-09-06 12:50:23

标签: javascript internet-explorer cufon invalid-argument

好的,我对这个有点难过。我使用Cufon用非Web标准字体替换我的文本。这是一个我用了很多钱的剧本。从来没有遇到任何问题。随之而来的是IE,它决定毁了我的一天。

我正在使用最新版本的cufon(截至本文发布之日),并在我的 header.php 文件中引用了许多不同的元素(对于Wordpress网站) :

    <script type="text/javascript" language="javascript" >Cufon.replace('.learnmore', { color: '#fff', textShadow: '1px 1px #0e1b0a', hover: { textShadow: '1px 1px #000',  color: '#fff'   }   });     </script>
    <script type="text/javascript" language="javascript" >Cufon.replace('.logo span, h1, h2, h4 , h5, h6, .learnmore, .prosto_button, .comment-reply-link, .slide_button, .page_title .bold p, .textonlycont, .h-title', { fontFamily: "Aller"});   </script>
    <script type="text/javascript" language="javascript" >Cufon.replace('.h-title', { textShadow: '1px 2px #5C1003' });     </script>
    <script type="text/javascript" language="javascript" >Cufon.replace('h1', { color: '-linear-gradient(white, #ececec)', textShadow: '#862905 0 2px'});   </script>
    <script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/pondera/js/cufon/Vegur.font.js?ver=1.0.0'></script>
    <script type="text/javascript" language="javascript" >Cufon.replace('h3, #serv-benefit h4, p.quote, #letstalk label', { fontFamily: "Vegur"});  </script>
    <script type="text/javascript" language="javascript" >Cufon.replace('#letstalk label', { fontFamily: "Vegur", textShadow: '1px 2px #293719' }); </script>

不确定这是否是引用多种不同字体的最佳方式,但它在所有浏览器中工作正常IE(特别是 v.8.0.7 ,我目前正在运行)。 IE提供以下错误报告:

  

网页错误详情:

     

消息:参数无效。   行:7   查尔:8520   代码:0   URI:http://localhost/wordpress/wp-content/themes/pondera/js/cufon/cufon-yui.js?ver=1.0.0

我调查了Cufon js文件,这似乎就在D.replaceChild引用之前。现在我远离JS专家,所以我不知道是什么导致了这个问题......

仅供参考,通过测试,我试图删除所有条形码的第一个Cufon.replace(...引用(即上面的代码)以查看它是否是我的编码不好但是这并没有解决它。< / p>

非常感谢任何建议!提前感谢您阅读本文,如果需要,我很乐意提供更多信息。

1 个答案:

答案 0 :(得分:0)

好吧我觉得我已经找到了一种灵魂(可能是各种各样的)......而且可能是Cufon本身的一个错误(虽然如果我错了就不会感到惊讶!)。

正如Epascarello建议的那样,我已经证明了我的代码布局更少的脚本标签:

    <script type="text/javascript" language="javascript" >
        Cufon.replace('.logo span, h1, h2, h5, h6, .learnmore, .prosto_button, .comment-reply-link, .slide_button, .page_title .bold p, .textonlycont, .h-title', { fontFamily: "Aller"});
        Cufon.replace('h1', { color: '-linear-gradient(white, #ececec)', textShadow: '#862905 0 2px'});
        Cufon.replace('.learnmore', {   color: '#fff', textShadow: '1px 1px #0e1b0a', hover: { textShadow: '1px 1px #000',  color: '#fff'   }});
        Cufon.replace('.h-title', { textShadow: '1px 2px #5C1003' });
    </script>
    <script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/pondera/js/cufon/Vegur.font.js?ver=1.0.0'></script>
    <script type="text/javascript" language="javascript" >
        Cufon.replace('h3, #serv-benefit h4, p.quote, #letstalk label', { fontFamily: "Vegur"});
        Cufon.replace('#letstalk label', { fontFamily: "Vegur", textShadow: '1px 2px #293719' });
    </script>

虽然这样做我花了一些时间来顺序测试插入的代码,以查看错误发生的时间。在此期间,我测试了每个选择器和所有工作吧... ... h4 !?!?为了澄清您是否将上述代码中的第一行修改为以下内容,将发生IE错误:

        Cufon.replace('.logo span, h1, h2, h4, h5, h6, .learnmore, .prosto_button, .comment-reply-link, .slide_button, .page_title .bold p, .textonlycont, .h-title', { fontFamily: "Aller"});
很奇怪啊?!我正在使用的灵魂是修改我的标记以避免H4标签,但可能这是Cufon的一个错误?

希望这有助于某人!