我已经将CKEditor.Net添加到ASP.NET web应用程序项目中。当我尝试使用javascript插入文本时,它会出现以下错误
Error: 'CKEDITOR' is undefined这是我的密码
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="eLetters.Test" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
function insertText(text) {
CKEDITOR.instances.insertText('text');
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" runat="server"></CKEditor:CKEditorControl>
</asp:Content>C#
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(GetType(), "MyKey", "insertText('data');", true);
}我在这里做错什么了?
发布于 2013-02-23 02:43:49
尝试在标记中设置BasePath="~/ckeditor"。
下面是一个代码隐藏片段,用于实例化工具栏:
CKEditor1.config.toolbar = new object[]
{
new object[] { "Bold", "Italic", "Underline", "Strike", "-", "Cut",
"Copy", "Paste", "PasteText", "-", "NumberedList", "BulletedList",
"-", "Outdent", "Indent", "Blockquote", "-", "JustifyLeft",
"JustifyCenter", "JustifyRight", "JustifyBlock"} };注释掉文本插入脚本,并将其设置为开始;-)
https://stackoverflow.com/questions/15036379
复制相似问题