xheditor用法

1.下载xheditor,加在项目中

引用js:

    <script src="xheditor/xheditor-1.2.1.min.js" type="text/javascript"></script>
    <script src="xheditor/xheditor_lang/zh-cn.js" type="text/javascript"></script>


function submitForm() { $('#form1').submit(); }

function pageInit() {
    $.extend(XHEDITOR.settings, { shortcuts: { 'ctrl+enter': submitForm} });
    $('#elm1').xheditor({ upLinkUrl: "upload.aspx", upLinkExt: "zip,rar,txt", upImgUrl: "upload.aspx", upImgExt: "jpg,jpeg,gif,png", upFlashUrl: "upload.aspx", upFlashExt: "swf", upMediaUrl: "upload.aspx", upMediaExt: "wmv,avi,wma,mp3,mid" });
    /*$('#elm2').xheditor({ upLinkUrl: "upload.aspx?immediate=1", upLinkExt: "zip,rar,txt", upImgUrl: "upload.aspx?immediate=1", upImgExt: "jpg,jpeg,gif,png", upFlashUrl: "upload.aspx?immediate=1", upFlashExt: "swf", upMediaUrl: "upload.aspx?immediate=1", upMediaExt: "wmv,avi,wma,mp3,mid" });
    $('#elm3').xheditor({ upLinkUrl: "uploadattach.php", upLinkExt: "zip,rar,txt" });
    $('#elm4').xheditor({ upImgUrl: "uploadthumb.php", upImgExt: "jpg,jpeg,gif,png" });
    $('#elm5').xheditor({ upFlashUrl: "uploadembed.php", upFlashExt: "swf", upMediaUrl: "uploadembed.php", upMediaExt: "wmv,avi,wma,mp3,mid" });
    $('#elm6').xheditor({ upLinkUrl: "upload.aspx", upLinkExt: "zip,rar,txt", upImgUrl: "upload.aspx", upImgExt: "jpg,jpeg,gif,png", onUpload: insertUpload });
    */
}


function SetEditor() {
    pageInit();
}

$(function () {
    SetEditor();
    GetInfo();
})

 

<textarea id="elm1" runat="server" name="elm1" rows="12" cols="80" style="width: 80%"></textarea>

3.取值:

  1. 使用jQuery的标准取值方法:$('#textarea_id').val();
  2. 使用xhEditor提供的专用读值API接口:editor.getSource

 

 

你可能感兴趣的:(xheditor用法)