CKEditor在本地显示但不在iis服务器上显示

时间:2016-06-07 08:10:45

标签: javascript asp.net ckeditor

我无法在我的网络应用程序中显示ckeditor。我可以在本地看到ckeditor文本框,但没有任何东西在服务器上显示。我尝试了几个步骤,如添加特定页面,但仍然没有达到解决方案。我可以在我的浏览器上看到ckeditor脚本,但文本框不会显示在浏览器上.Below是代码:

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style1 {
            width: 176px;
        }
        .auto-style2 {
            width: 176px;
            height: 54px;
        }
        .auto-style3 {
            height: 54px;
        }
        .auto-style4 {
            width: 176px;
            height: 51px;
        }
        .auto-style5 {
            height: 51px;
        }
    </style>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript" src="../ckeditor/ckeditor.js"></script>

  <table style="width: 100%; height: 333px;">
                <tr>
                    <td class="auto-style1">&nbsp; Title&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;</td>
                    <td>&nbsp; &nbsp;<asp:TextBox ID="txtTitle" runat="server" Height="29px" Width="451px" MaxLength="100"></asp:TextBox>
                        <asp:Label ID="lblNewsId" runat="server" Visible="False"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="auto-style1">&nbsp; Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;</td>
                    <td>&nbsp;&nbsp; &nbsp; <CKEditor:CKEditorControl ID="txtDescp" BasePath="/ckeditor/"   runat="server">
   </CKEditor:CKEditorControl>
                    </td>
                </tr>
                <tr>
                  </table>

1 个答案:

答案 0 :(得分:1)

您的脚本src是相对于您的页面位置(以两个点开头):src="../ckeditor/ckeditor.js"

这意味着如果您的asp.net页面位于子文件夹中,则找不到ckeditor文件夹。

您可以使用ResolveClientUrl()在运行时呈现正确的src:

<script type="text/javascript" src="<%=ResolveClientUrl("~/ckeditor/ckedtor.js")%>"></script>

或者,如果您知道您的应用程序位置在本地和远程保持不变(例如http://localhost/myapphttp://myserver/myapp),您可以从根目录开始设置src:

<script type="text/javascript" src="/myapp/ckeditor/ckedtor.js"></script>