html編輯器kindeditor的使用,編輯器kindeditor

來源:互聯網
上載者:User

html編輯器kindeditor的使用,編輯器kindeditor

1.下載KindEditor最新版本。

2.把kindeditor放在你的網站目錄下,隨意目錄,只要路徑設定對就可以!

3.要顯示編輯器的位置添加TEXTAREA輸入框。如果已經有TEXTAREA,屬性裡添加ID即可。 

<textarea id="content_1" name="content" style="width:700px;height:300px;"></textarea>


4.在相應頁面上添加kindeditor的引用,添加如下代碼:

<script type="text/javascript" charset="utf-8" src="/editor/kindeditor.js"></script>
<script type="text/javascript">
    KE.show({
        id : 'content_1' //TEXTAREA輸入框的ID
    });
</script>

src=..... 這雷根據你的kindeditor置放位置而變化。

擷取textarea的常值內容:
1.在<textarea id="content_1" name="content" style="width:700px;height:300px;"></textarea>
後面添加隱藏input和button,代碼如下:
<input id="content_1_1" type="hidden" runat="server" value="" />
<asp:Button ID="Button1" runat="server" Text="儲存" OnClientClick="save();" OnClick="Button1_Click" CssClass="i_1" />

添加事件處理代碼
1.首先是用戶端代碼,在伺服器代碼之前執行,代碼如下:


function save() 
         {
             var s = KE.util.getData("content_1");
             s = KE.util.escape(s);
             document.getElementById("content_1_1").value = s;
         }

已經在伺服器控制項中取到了,儲存的時候保持content_1_1的value就可以了。
2.伺服器代碼,代碼如下:


protected void Button1_Click(object sender, EventArgs e)
    {
        在這裡寫你要執行的伺服器代碼,因為已經去到值了。
    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.