0

我无法在我的 Firefox 扩展中选择文本字段内的文本。光标仅停留在文本字段的开头,当我单击并拖动鼠标时不会移动。但是,我可以使用键盘上的 shift 和箭头键来选择文本。

我正在加载一个 html 页面,该页面在 XUL 面板中的 iFrame 中包含 2 个文本字段和 2 个按钮。

我正在使用的代码如下:

//popup.xul
<?xml version="1.0" encoding="UTF-8"?>
<panel id="ext-popup" title="My Extension" orient="vertical" autostretch="always"
       buttons=","
       defaultButton=","
       shadow="true"
       style="padding: 0px; margin: 0px; height: 32px; -moz-window-shadow : sheet"
       onload="init();"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

    <script src="chrome://myext/content/popup.js"/>
    <iframe src="chrome://myext/content/popup.html" type="content"
            style="background-color: white; -moz-window-shadow : default; width: 490px; height: 260px;overflow: hidden;"
            id="popupContent"/>
</panel>

是否需要设置任何选项以允许在文本字段中进行选择?

4

1 回答 1

0

终于发现问题了。问题出在css上。我正在使用以下css属性:

-moz-user-select: none

当我删除它时,我能够选择文本。

于 2012-10-04T09:48:02.173 回答