日期:2014-05-17  浏览次数:20407 次

关于如何使用富文本编辑器FCKeditor的问题
1、
<head>
 <script type="text/javascript" src="/fckeditor/fckeditor.js">
  window.onload = function () {
  var oFCKeditor = new FCKeditor('TextArea1" + id + "');
  oFCKeditor.ReplaceTextarea();
   
   
  }
</script>
</head>

2、
<body>
<form></form>
<textarea id='TextArea1" + id + "'></textarea>
<script type="text/javascript">
  function replyData(id) { //回复留言函数
  var textarea1 = $(oFCKeditor).val();
  //var textarea1 = $("#TextArea1" + id).val();
  //alert("aa");
  $.ajax({  
  type: "POST",
  cache: false,
  url: "WebService.asmx/Update", /* 注意后面的名字对应CS的方法名称 */

  data: {"id":id,"textarea1":textarea1}, /* 注意参数的格式和名称 */
  contentType: "application/x-www-form-urlencoded",
  dataType: "xml",
  success: function (ret) {

  //判断 ret 删除成功再决定是否刷新getData();
  getData();
  }

  });
  }
</script>
</body>

以上是主要代码,有删节,不知道哪里错了,我用fckeditor来替换textarea,但F5调试后,出现的依然是textarea,功能倒正常,一样可以update。

------解决方案--------------------
window.onload = function () {
var oFCKeditor = new FCKeditor('TextArea1" + id + "');
oFCKeditor.ReplaceTextarea();

你这个id哪里赋值了》


html里面写
<textarea id='TextArea1" + id + "'></textarea>

这样 id是不会赋值的,必须在js里面使用

------解决方案--------------------
向这样的有官方网站的 可以直接去研究官方的API 会有简单的例子的。
------解决方案--------------------
<textarea id= 'TextArea1<%#Eval("id")%>'> </textarea> 

你这个id是哪里来的?如果是绑定的话

如果不是绑定的话,页面上只有一个TextArea1,你直接写死就可以啦