我正尝试在WYSIWYG编辑器中插入图像,但无法在Internet Explorer(6/7)中插入图像,尽管它在Firefox中运行良好。它失败了,没有抛出任何错误。
这就是我正在使用的:
execCommand('insertImage', false, 'absolute/path/to/an/image');发布于 2009-10-08 20:03:53
谢谢你的回答,但事实证明,我的问题出现了,因为如果我的iframe ( richeditor容器)没有焦点,IE就无法插入图像。因此,在尝试使用execCommand之前,我使用了以下代码,它起作用了。
document.getElementById('iframeId').contentWindow.focus();发布于 2009-10-07 19:04:37
在IE中,execCommand存在于document对象上,而不是window对象上。(好吧,它也存在于range对象中,但不管怎样。)
尝试:
document.execCommand("insertImage", false, "absolute/path/to/an/image");https://stackoverflow.com/questions/1533258
复制相似问题