溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

php kindeditor使用方法是什么

發布時間:2020-09-22 10:17:27 來源:億速云 閱讀:184 作者:小新 欄目:編程語言

php kindeditor使用方法是什么?這個問題可能是我們日常學習或工作經常見到的。希望通過這個問題能讓你收獲頗深。下面是小編給大家帶來的參考內容,讓我們一起來看看吧!

php kindeditor使用方法:首先下載kindeditor并解壓到項目中;然后刪除不需要的文件夾;最后初始化kindeditor富文本編輯器即可。

php kindeditor使用方法是什么

  1. 下載kindeditor
    可以選擇去官網下載(http://kindeditor.net/down.php),不過要翻墻;或者直接CSDNhttp://download.csdn.net/download/dknightl/9813052

  2. 下載解壓完放入自己的項目中
    在解壓完后可以刪除不需要的文件夾,我是刪除了asp、asp.net、jsp、php,examples可以放到其他地方,用作代碼參考。
    php kindeditor使用方法是什么

  3. 初始化kindeditor富文本編輯器


  • 首先先導入下面css和js文件
        <link rel="stylesheet" href="../themes/default/default.css" />
        <script charset="utf-8" src="../kindeditor-min.js"></script>
        <script charset="utf-8" src="../lang/zh_CN.js"></script>
  • 然后初始化(textarea 為富文本編輯器主題,script代碼初始化)
    <textarea id="mul_input" name="content" style="width:700px;height:200px;visibility:hidden;display: block;">KindEditor</textarea> 

    <script>
        //簡單模式初始化
        var editor;
        KindEditor.ready(function(K) {
            editor = K.create('textarea[name="content"]', {
                resizeType : 1,
                allowPreviewEmoticons : false,
                allowImageUpload : false,
                items : [                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',                    'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',                    'insertunorderedlist', '|', 'emoticons', 'image', 'link']
            });
        });    </script>

php kindeditor使用方法是什么

        //默認模式        <script>
            var editor;
            KindEditor.ready(function(K) {
                editor = K.create('textarea[name="content"]', {
                    allowFileManager : true
                });
                K('input[name=getHtml]').click(function(e) {
                    alert(editor.html());
                });
                K('input[name=isEmpty]').click(function(e) {
                    alert(editor.isEmpty());
                });
                K('input[name=getText]').click(function(e) {
                    alert(editor.text());
                });
                K('input[name=selectedHtml]').click(function(e) {
                    alert(editor.selectedHtml());
                });
                K('input[name=setHtml]').click(function(e) {
                    editor.html('<h4>Hello KindEditor</h4>');
                });
                K('input[name=setText]').click(function(e) {
                    editor.text('<h4>Hello KindEditor</h4>');
                });
                K('input[name=insertHtml]').click(function(e) {
                    editor.insertHtml('<strong>插入HTML</strong>');
                });
                K('input[name=appendHtml]').click(function(e) {
                    editor.appendHtml('<strong>添加HTML</strong>');
                });
                K('input[name=clear]').click(function(e) {
                    editor.html('');
                });
            });        </script>
    </head>
    <body>
        <h4>默認模式</h4>
        <form style="margin: 0;">
            <textarea name="content" style="width:800px;height:400px;visibility:hidden;display: block;">KindEditor</textarea>
            <p>
                <input type="button" name="getHtml" value="取得HTML" />
                <input type="button" name="isEmpty" value="判斷是否為空" />
                <input type="button" name="getText" value="取得文本(包含img,embed)" />
                <input type="button" name="selectedHtml" value="取得選中HTML" />
                <br />
                <br />
                <input type="button" name="setHtml" value="設置HTML" />
                <input type="button" name="setText" value="設置文本" />
                <input type="button" name="insertHtml" value="插入HTML" />
                <input type="button" name="appendHtml" value="添加HTML" />
                <input type="button" name="clear" value="清空內容" />
                <input type="reset" name="reset" value="Reset" />
            </p>
        </form>
    </body>

php kindeditor使用方法是什么


感謝各位的閱讀!看完上述內容,你們對php kindeditor使用方法是什么大概了解了嗎?希望文章內容對大家有所幫助。如果想了解更多相關文章內容,歡迎關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女