• xajax如何获取fckeditor的值


    xajax向html页面输出fckeditor是容易的,但是xajax如何获取fckeditor的值?在xajax的wiki上说了,但还是不明白,测试不成功,最后在fckeditor 2.4.3的_samples/html/sample08.html中找到了答案

    function GetContents()

    {

    // Get the editor instance that we want to interact with.

    var oEditor = FCKeditorAPI.GetInstance('content1') ;



    // Get the editor contents in XHTML.

    //alert( oEditor.GetXHTML( true ) ) ; // "true" means you want it formatted.

    var a = oEditor.GetXHTML( true );

    xajax_show(a);

    }



    function GetInnerHTML()

    {

    // Get the editor instance that we want to interact with.

    var oEditor = FCKeditorAPI.GetInstance('content1') ;



    alert( oEditor.EditorDocument.body.innerHTML ) ;

    }
    <?php

    require_once('./xajax/xajax.inc.php');



    $xajax = new xajax();

    $xajax->registerFunction('show');

    $xajax->registerFunction('load');

    $xajax->processRequest();

    echo $xajax->getJavascript('./xajax');



    //显示编辑器

    function show($form) {

    $obj = new xajaxResponse();

    $obj->alert($form);

    return $obj;

    }



    //根据内容载入编辑器

    function load() {

    require_once('../../includes/fckeditor/fckeditor.php');

    $editor = new fckeditor('content1');

    $editor->BasePath = '../../includes/fckeditor/';

    $editor->Value = "test";

    $content = $editor->createhtml();

    $obj = new xajaxResponse();

    $obj->assign('content','innerHTML',$content);

    return $obj;

    }

    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <link rel="icon" href="/favicon.ico" type="image/x-icon" />

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

    <title></title>

    <meta name="Description" content="" />

    <meta content="" name="Keywords" />

    <link rel="stylesheet" rev="stylesheet" href="" type="text/css" media="all" />

    <script language="javascript">

    <!--



    function GetContents()

    {

    // Get the editor instance that we want to interact with.

    var oEditor = FCKeditorAPI.GetInstance('content1') ;



    // Get the editor contents in XHTML.

    //alert( oEditor.GetXHTML( true ) ) ; // "true" means you want it formatted.

    var a = oEditor.GetXHTML( true );

    xajax_show(a);

    }



    function GetInnerHTML()

    {

    // Get the editor instance that we want to interact with.

    var oEditor = FCKeditorAPI.GetInstance('content1') ;



    alert( oEditor.EditorDocument.body.innerHTML ) ;

    }



    //-->

    </script>



    </head>



    <body>



    <script language="javascript">

    <!--

    xajax_load();

    //-->

    </script>



    <form action="" method="post" name="f1" id="f1">

    <a href="#" onclick="xajax_load();return false;" title="">载入编辑器</a>

    <a href="#" onclick="setTimeout(xajax_show(xajax.getFormValues('f1')),1500);" title="#">获取输入框的值</a>

    <a href="#" onclick="GetContents();" title="">获取方式2</a>

    <div id="content">



    </div>





    </form>



    </body>

    </html>

    http://www.corange.cn/archives/2008/10/2081.html

  • 相关阅读:
    第九十一天 how can I 坚持 技术-永远的技术
    第九十天 how can I 坚持
    Java控制台中输入中文输出乱码的解决办法
    【体系结构】转移预测器设计与比较1
    Ubuntu 13.04 用Sublime Text 2 编译运行 JAVA
    HDU 4605 Magic Ball Game (在线主席树|| 离线 线段树)
    个人重构机房收费系统之报表
    快速排序的递归和非递归实现
    HDU 3721 Building Roads (2010 Asia Tianjin Regional Contest)
    体验决定深度,知识决定广度。你的人生是什么呢? 操蛋和扯蛋没必要纠结 唯有继续
  • 原文地址:https://www.cnblogs.com/zerogo/p/2209178.html
Copyright © 2020-2023  润新知