execCommand问题 [英] execCommand problem

查看:114
本文介绍了execCommand问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我为我的网页开发了一个html编辑器,因为我无法找到针对asp.net应用程序的可用html编辑器的回车键。现在我已经完成了我需要的所有这个编辑器,但execCommand不能与IE一起工作,它与FF完美配合。当我提醒myEditor.document.queryCommandEnabled(''Bold'')[对于粗体命令]我得到错误的IE,其中myEditor是在可编辑模式下使用的Iframe ID。请帮帮我...

i会在这里发布整个代码。

// html part

[HTML]< IFRAME name =" ; navoCHatEditor"宽度= QUOT; 100%QUOT;高度= QUOT; 100" onfocus =" setKeypressHandler(window.frames.navoCHat Editor,keyPressHandler)" >< / IFRAME>

[/ HTML]

// js part

展开 | 选择 | Wrap | 行号

解决方案

欢迎来到TSDN。


参见这个链接(不完全是你想要的,但它可能会有所帮助)。


通常情况下,反之亦然(execCommand在Firefox中不起作用)。


我遇到了同样的问题 - 我通过在颜色p中放置一个按钮来解决它每个颜色都是alette,并使用CSS设置样式。


onClick事件在normal上DOM元素将焦点从可信区域移开,而按钮和提交输入类型则没有(尽管显然在这种情况下按钮是优选的,以避免必须在函数中添加返回false语句)。


< blockquote> 解决方案:


您可以使用以下属性来解决此问题。

展开 | 选择 | Wrap | 行号


hi all,

i m developing an html editor for my web page since i cannot trace out the enter key press for the available html editors for asp.net app. now i have done everything that i need with this editor but the execCommand doesnt work with IE, it works perfectly with FF. when i alerted myEditor.document.queryCommandEnabled(''Bold'') [ for bold command ] i get false for IE where myEditor is the Iframe id which is used in editable mode. please help me...
i will post the whole code here.
//html part
[HTML]<IFRAME name="navoCHatEditor" width="100%" height="100" onfocus="setKeypressHandler(window.frames.navoCHat Editor, keyPressHandler)" ></IFRAME>
[/HTML]
//js part

Expand|Select|Wrap|Line Numbers

解决方案

Welcome to TSDN.

See this link (not exactly what you want, but it might help).

Usually, it''s the other way round (execCommand doesn''t work in Firefox).


I was having the same problem - I got around it by placing a button inside the color palette where each colour is and styling it with CSS.

The onClick event on "normal" DOM elements takes the focus away from the contenteditable region whereas button and submit input types do not (though obviously buttons are preferrable in this case to avoid having to keep adding return false statements into your functions).


Solution:

You can use the following attribute to get around this problem.

Expand|Select|Wrap|Line Numbers


这篇关于execCommand问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆