可编辑的div不在firefox上工作

时间:2022-12-06 18:06:39

Hi i am using an dynamic div which is editable for input text. its working fine on IE but not on firefox. I need to show html content in div. can we make div editable for firefox also?

嗨我正在使用可编辑输入文本的动态div。它在IE上工作正常,但在Firefox上没有。我需要在div中显示html内容。我们可以为Firefox编辑div吗?

1 个解决方案

#1


Firefox requires the designMode to be set on an iFrame. The specification doesn't explicitly mention this but the following quote sort of implies it already

Firefox要求在iFrame上设置designMode。规范没有明确提到这一点,但以下引用的含义已经暗示了它

For example, in JavaScript, if you have an iframe with an id of 'edit', you can get its contentDocument and set designMode to "on" like this:

例如,在JavaScript中,如果您有一个ID为“edit”的iframe,您可以获取其contentDocument并将designMode设置为“on”,如下所示:

You will find alot of browser differences in how they handle designMode so be prepared and take it as a challenge or else you might lose a few hairs in the process.

你会发现很多浏览器在处理designMode方面存在差异,所以要做好准备并把它当作一个挑战,否则你可能会在这个过程中失去一些头发。

#1


Firefox requires the designMode to be set on an iFrame. The specification doesn't explicitly mention this but the following quote sort of implies it already

Firefox要求在iFrame上设置designMode。规范没有明确提到这一点,但以下引用的含义已经暗示了它

For example, in JavaScript, if you have an iframe with an id of 'edit', you can get its contentDocument and set designMode to "on" like this:

例如,在JavaScript中,如果您有一个ID为“edit”的iframe,您可以获取其contentDocument并将designMode设置为“on”,如下所示:

You will find alot of browser differences in how they handle designMode so be prepared and take it as a challenge or else you might lose a few hairs in the process.

你会发现很多浏览器在处理designMode方面存在差异,所以要做好准备并把它当作一个挑战,否则你可能会在这个过程中失去一些头发。