【问题标题】:Firefox Extension preference window onsynctopreference ButtonFirefox 扩展首选项窗口 onsynctopreference 按钮
【发布时间】:2011-06-26 04:13:25
【问题描述】:

我有一个 XUL 按钮,一旦单击它就会监听击键。捕获击键时,它将按钮的标签设置为击键的 keyCode。我想将此值保存到首选项中。我正在使用 onsynctopreference 告诉按钮使用其标签的值作为首选项。然而,onsynctopreference 似乎触发了 onmouseup。问题是,用户应该点击按钮,然后输入一个键。输入密钥后,我希望触发 onsynctopreference。

您建议我如何处理这个问题?无论如何要手动调用 onsynctopreference 吗?

【问题讨论】:

    标签: javascript firefox firefox-addon xul keycode


    【解决方案1】:

    使用onkeypress 处理程序手动调用onsynctopreference

      function foo()
        {
        /* ... */
        onsynctopreference();
        }
    
      document.onkeypress = foo;
    

    【讨论】:

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