zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    184. Department Highest Salary【leetcode】sql,join on
    181. Employees Earning More Than Their Managers【leetcode】,sql,inner join ,where
    178. Rank Scores【leetcode】,sql
    177. Nth Highest Salary【leetcode】,第n高数值,sql,limit,offset
    176. Second Highest Salary【取表中第二高的值】,sql,limit,offset
    118. Pascal's Triangle【LeetCode】,java,算法,杨辉三角
    204. Count Primes【leetcode】java,算法,质数
    202. Happy Number【leetcode】java,hashSet,算法
    41. First Missing Positive【leetcode】寻找第一个丢失的整数,java,算法
    删除
  • 原文地址:https://www.cnblogs.com/zerogo/p/2209178.html
Copyright © 2011-2022 走看看