我已将CKEditor.Net添加到我的 ASP.NET Web 应用程序项目中。当我尝试使用 javascript 插入文本时,会出现此错误
Error: 'CKEDITOR' is undefined
这是我的代码,
HTML
<%@ 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);
}
我在这里做错了什么?