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

asp.net MVC 3.0 中怎样使用FckEditor编辑器?为什么我的页面上显示的空白?

我写的HtmlHelper:
namespace System.Web.Mvc.Html
{
  public static class FckEditorExtension
  {
  public static MvcHtmlString FckText(this HtmlHelper helper,string name,FckConfig objFckConfig)
  {
  StringBuilder strBuilder = new StringBuilder();
  strBuilder.Append("<script type=\"text/javascript\">");
  strBuilder.Append("var f=new FCKeditor('" + name + "');");
  strBuilder.Append("f.Width='"+objFckConfig.Width+"';");
  strBuilder.Append("f.Height='"+objFckConfig.Height+"';");
  strBuilder.Append("f.ToolbarSet='Basic';");
  strBuilder.Append("f.Config['SkinPath'] = f.BasePath + 'editor/skins/"+objFckConfig.Skin+"/';");
  strBuilder.Append("f.Create();");
  strBuilder.Append("</script>");
  return MvcHtmlString.Create(strBuilder.ToString());
  }
  }
  public enum FckSkin { Default,Office2003,silver }
  /// <summary>
  /// FckEditor控件配置类
  /// </summary>
  public class FckConfig
  {
  public string Width { get; set; }
  public string Height { get; set; }
  public FckSkin Skin { get; set; }
  }
}
但是 在页面中输出的编辑器是空白!firebug一下报老多东西未定义,页面源代码:
<div class="editor-field">
  <script type="text/javascript" src="/fckeditor/fckeditor.js"></script>
  <script type="text/javascript" src="/fckeditor/fckconfig.js"></script>
  <span>正文:</span> <script type="text/javascript">var f=new FCKeditor('Content');f.Width='600';f.Height='300';f.ToolbarSet='Basic';f.Config['SkinPath'] = f.BasePath + 'editor/skins/Default/';f.Create();</script><input type="hidden" style="display:none" value="" name="Content" id="Content"><input type="hidden" style="display:none" value="SkinPath=%2Ffckeditor%2Feditor%2Fskins%2FDefault%2F" id="Content___Config"><iframe width="600" scrolling="no" height="300" frameborder="0" src="/fckeditor/editor/fckeditor.html?InstanceName=Content&amp;Toolbar=Basic" id="Content___Frame"></iframe>;
   
  <span data-valmsg-replace="true" data-valmsg-for="Content" class="field-validation-valid"></span>
  </div>
哪位大虾帮解决一下啊?急用!

------解决方案--------------------
<script type="text/javascript" src="/fckeditor/fckeditor.js"></script>
这路径不对吧
------解决方案--------------------
你看看这个吧

http://www.codeproject.com/Articles/27948/Integrating-FCKeditor-in-ASP-NET
------解决方案--------------------
strBuilder.Append("f.ToolbarSet='Basic';");
strBuilder.Append("f.Config['SkinPath'] = f.BasePath + 'editor/skins/"+objFckConfig.Skin+"/';");
 这个路径对吗。如果不对可能没引用到。
------解决方案--------------------


引用的地址没有正确,所以是空白的

你先把相对的目录给找出来,再去一层一层的对
你怎么知道没有那个文件夹