• 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

  • 相关阅读:
    tif文件导入postgresql
    与你相遇好幸运,使用redis设置定时任务
    用sinopia搭建npm私服
    Postman设置Header不生效问题
    iOS 动态加载LaunchScreen上的图片
    iOS 封装一个带复制功能的UILabel
    ios开发文字排版,段落排版,富文本
    iOS使用hitTest和loadView处理UIView事件传递
    iOS 更改状态栏颜色和隐藏状态栏
    iOS scrollView嵌套tableView的手势冲突解决方案
  • 原文地址:https://www.cnblogs.com/zerogo/p/2209178.html
Copyright © 2020-2023  润新知