HTML文档中的Rich Text Editors如何实现其丰富的文本格式? [英] How do Rich Text Editors in HTML documents achieve their rich text formatting?
问题描述
JS是否识别用户输入的字符?如何完成?
编辑:
的研究(Google规则!),我发现了一些很好的信息。对于可能感兴趣的其他人,这些链接对我非常有帮助:
- http://www.webreference.com/programming/javascript/gr/column11/
- http://www.webreference.com/programming/javascript/gr/column12/
我认为答案是你正在看的是通常不是实际的< textarea>
。这是一个< div>
或< span>
使其看起来像一个文本区域。
富文本编辑器将具有修改内容的控件具有常规html标记(< strong>
,< em>
等)的span /一个完整的富文本编辑器
Could you please explain how the text in the textarea gets styled in rich-text editors? I've tried to style text in the form but it doesn't change.
Is it JS that recognizes characters typed by the user? How's that done?
Edit:
After a bit of research (Google rules!), I've found some excellent information. For others who might be interested, these links were very helpful to me:
- http://www.webreference.com/programming/javascript/gr/column11/
- http://www.webreference.com/programming/javascript/gr/column12/
I think the answer is that what you're looking at is typically NOT an actual <textarea>
. It's a <div>
or <span>
made to look like a text area. A regular HTML textarea doesn't have individual formatting of the text.
"Rich-Text editors" will have controls that modify the contents of the span/div with regular html markup (<strong>
, <em>
, etc.) to emulate a full-blown rich text editor
这篇关于HTML文档中的Rich Text Editors如何实现其丰富的文本格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!