【问题标题】:raphael text() not working in ie9raphael text() 在 ie9 中不起作用
【发布时间】:2011-05-30 16:51:45
【问题描述】:

为什么下面的例子在 ie9 中不起作用?

http://jsfiddle.net/dzyyd/2/

它吐出一个控制台错误:

“对方法或属性访问的意外调用。”

【问题讨论】:

    标签: text internet-explorer-9 raphael


    【解决方案1】:

    我很快就找到了。您创建了元素,但没有将其放在任何地方。将其添加到文档正文后,一切似乎都很好。

    this._width=300;
    this._height=300;
    this._bgSvgContainer = document.createElement("div");
    //NOTE: add the created div to the body of the document so that it is displayed
    document.body.appendChild(this._bgSvgContainer);
    var bgCanvas = Raphael(this._bgSvgContainer, this._width, this._height);
    this._bgCanvas = bgCanvas;
    var num = this._bgCanvas.text(this._width-10,this._height-10,"1");
    

    【讨论】:

      【解决方案2】:

      用这么小的代码片段真的很难说(对我来说不能在任何浏览器上运行),但这可能是一个范围问题 this 在 IE 中事件期间与使用 W3C 的 this 完全不同事件模型。请参阅:quirksmode-Event order-Microsoft 模型的问题

      【讨论】:

        猜你喜欢
        • 2012-03-05
        • 2018-04-29
        • 2012-02-09
        • 2012-08-02
        • 2014-05-04
        • 2011-07-29
        • 2015-10-08
        • 2013-10-29
        • 2017-08-27
        相关资源
        最近更新 更多