Online HTML editor-Use of htmlarea

Source: Internet
Author: User
Online HTML editor --- htmlarea(12:02:57)
Classification: JS + Ajax
    I can improve my work. I have been trying to solve the problem in the editor. Today I asked my colleagues to know that it is so simple that I use an editor! I don't know whether the text editor Sina is self-developed or open-source. Next I will introduce htmlarea...    1. Put htmlarea in your directory    2. Add a JS section and add a function.        VaR editor = NULL;          Function initeditor (){          Editor = new htmlarea ("content"); // content        Editor. Generate ();}   3. Load initeditor () in the onload time of the body ();    4. The onsubmit event of the form calls this ("content"). value = editor. gethtml ();An example is provided:

<% @ Page Language = "Java" contenttype = "text/html; charset = UTF-8" %>
<% @ Page import = "util. Constant" Import = "Ent. JavaBean. bloginfo" Import = "Ent. JavaBean. Article" %>
<% @ Page import = "Java. util. List" Import = "Ent. JavaBean. Type" Import = "Java. util. iterator" %>
<%
Bloginfo ent = (bloginfo) request. getattribute ("Ent ");
Article article = (Article) request. getattribute ("article ");
List list = (list) request. getattribute ("ts ");
Iterator it = List. iterator ();
%>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en"
 Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>

<HTML>
<Head>
<Title> enterprise blog </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<SCRIPT type = "text/JavaScript" src = "<% = constant. squidhost %>/JS/ent. js"> </SCRIPT>
<LINK rel = "stylesheet" type = "text/CSS" href = "<% = constant. squidhost %>/CSS/global.css"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "<% = constant. squidhost %>/CSS/ent/blog_back.css"/>
<SCRIPT>
 _ Editor_url = "<% = constant. enthost %>/webapp/JSP/ent/htmlarea /";
  _ Editor_lang = "zh-cn-utf8 ";
</SCRIPT>
<SCRIPT>
If (window. Top = Window ){
  Window. Location. href = "<% = constant. enthost %>/mainctrl? Page = loadblogmainpage & Right = art_pub ";
}
</SCRIPT>
</Head>

<Body onload = "initeditor ();">

  
  <Div class = "col707">
   <Div class = "col707_top"> </div>
   <Div class = "con2 H1">
   <Form name = "article_form" id = "article_form" Action = "translatectrl" method = "Post">
   <Input type = "hidden" name = "ID" id = "ID" value = "<% = article = NULL? 0: article. GETID () %> "/>
   <Input type = "hidden" name = "page" id = "page" value = "editarticlepage"/>
   <Input type = "hidden" name = "item" id = "item" value = "article"/>
    <Input type = "hidden" name = "path" id = "path" value = "<% = constant. enthost %>"/>
    <H2> publish an article </H2>
    <Div class = "part">
     <Div class = "L"> Article Title: </div>
     <% String Title = article = NULL? Null: article. gettitle (); %>
     <Div class = "R">
      <Input type = "text" name = "article_title" id = "article_title" size = "40" maxlength = "20" value = "<% = title = NULL? "Enter the title": Title %> "onclick =" set_value ('Enter the title', this); "/>
      
     </Div>
     <Div class = "clear"> </div>
    </Div>
    <Div class = "clear"> </div>
    <Div class = "part">
     <Div class = "L"> topic: </div>
     <Div class = "R">
      <Select name = "TID">
       <%
        While (it. hasnext ()){
         Type type = (type) it. Next ();
       %>
         <Option value = "<% = type. GETID () %> "<% IF (article. getType () = type. GETID () {%> selected <% }%>>< % = type. getname () %> </option>
       <% }%>
      </SELECT>     
     </Div>
     <Div class = "clear"> </div>
    </Div>
    <Div class = "clear"> </div>
    <Div style = "text-align: Left; width: 630px; margin: 10px auto"> Article content: </div>
    <Div class = "Fabu">
     <% String content = article = NULL? "" :( Article. getcontent () = NULL? "": New String (article. getcontent (); %>
     <Textarea name = "article_content" id = "article_content" class = "inputstyle2"> <% = content %> </textarea>
     <SCRIPT type = "text/JavaScript" src = "<% = constant. enthost %>/webapp/JSP/ent/htmlarea. js"> </SCRIPT>
     <SCRIPT>
      VaR editor = NULL;
     Function initeditor (){
      Editor = new htmlarea ("article_content ");
      Editor. Generate ();
     }
     </SCRIPT>
   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.