Htmlarea is a pure js+html editor, theoretically can be set on any language platform, after the actual use can and ASP.net 2.0 + Ajax very good combination, now this blog system has taken it as an article editor, the following is the specific installation steps.
First download the HtmlArea3.0 and unzip to a directory in the Web project.
Lang/gb.js is a Chinese language file, the official default is ANSI code, if your Web.config set to Utf-8 (default), you need to open the Gb.js Notepad, save as a utf-8 format.
The following is a reference fragment:
<scripttype= "Text/javascript" >_editor_url= ". /htmlarea/"; _editor_lang=" GB ";</script>
<scripttype= "Text/javascript" src= ". /htmlarea/htmlarea.js "></script>
<asp:textboxid= "Htmlarea" cssclass= "Htmlarea" runat= "Server" height= "200px" textmode= "MultiLine" width= "100%" ></asp:TextBox>
The following is a reference fragment:
Protectedvoidpage_load (OBJECTSENDER,EVENTARGSE) {
if (! Page.IsPostBack) {
Stringbuildersb=newstringbuilder ();
Sb. Append ("vareditor=null;");
Sb. Append ("Functioniniteditor () {");
Sb. Append ("Editor=newhtmlarea" +articlebody1.findcontrol ("Htmlarea"). Clientid+ "");
Sb. Append ("Editor.generate ();}"); Sb. Append ("document.body.onload=initeditor;");
Scriptmanager.registerstartupscript (this. Page,this. GetType (), "Htmlareascript", sb. ToString (), true);
}
If UpdatePanel commits, you must also reinitialize the editor by executing the following statement after submission:
The following is a reference fragment:
Scriptmanager.registerstartupscript (this. Page,this. GetType (), "Htmlareascript", "Initeditor ();", true);