一、准备:
二、定义javascript的全局变量及引入js文件:
_editor_url = "${pageContext.request.contextPath}/htmlarea/";
_editor_lang = "en";
var editor = null;
function initEditor() {
editor = new HTMLArea("content");
editor.generate();
}
有句editor = new HTMLArea("content");"content"是表单中textarea属性的id,如:
三、在body的onload事件中加载initEditor():
如:
四、注意点:
1、editor = new HTMLArea("content");参数值是表单中textarea属性id;
2、在body的onload事件中加载initEditor();
3、表单onsubmit事件调用this['content'].value=editor.getHTML()
五、效果: