我只是想知道一个文本编辑器的作品(jquery),我在网上发现了很多jQuery文本编辑器。我的问题,编辑器本身不是一个textarea而是一个iframe我想,但怎么cursonr闪烁,如在文本区光标jQuery文本编辑器中的光标如何闪烁?
请检查该http://batiste.dosimple.ch/blog/posts/2007-09-11-1/rich-text-editor-jquery.html
如果你有一个网址,如何使文本编辑器,请让我知道
我只是想知道一个文本编辑器的作品(jquery),我在网上发现了很多jQuery文本编辑器。我的问题,编辑器本身不是一个textarea而是一个iframe我想,但怎么cursonr闪烁,如在文本区光标jQuery文本编辑器中的光标如何闪烁?
请检查该http://batiste.dosimple.ch/blog/posts/2007-09-11-1/rich-text-editor-jquery.html
如果你有一个网址,如何使文本编辑器,请让我知道
这似乎切换文档对象的designMode属性,并将其设置为 “开” 与此功能:
function tryEnableDesignMode(iframe, doc, callback) {
try {
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(doc);
iframe.contentWindow.document.close();
} catch(error) {
console.log(error)
}
if (document.contentEditable) {
iframe.contentWindow.document.designMode = "On";
callback();
return true;
}
else if (document.designMode != null) {
try {
iframe.contentWindow.document.designMode = "on";
callback();
return true;
} catch (error) {
console.log(error)
}
}
setTimeout(function(){tryEnableDesignMode(iframe, doc, callback)}, 250);
return false;
}
你所指的是所谓的所见即所得。
制作WYSIWYG的基本原理是拥有一个iframe,其属性为designMode = true。基本上,这是你如何拥有一个textarea的外观和感觉,但有额外的功能。
欲了解更多信息,你可以看看那些教程:
- http://www.emirplicanic.com/javascript/cross-browser-textarea-editor.php
- https://developer.mozilla.org/en/Rich-Text_Editing_in_Mozilla
- http://msdn.microsoft.com/en-us/library/ms537834(VS.85).aspx
或者以关键字 “所见即所得的JavaScript教程” 在谷歌搜索。
相关答案
- javascript Rich Text Editors
谢谢HoLyVieR, – john 2010-08-17 16:30:53
谢谢你非常感谢你的帮助 – john 2010-08-17 17:02:47