Javascript CKEditor未定义
我已添加到我的ASP.NET web应用程序项目中。当我尝试使用javascript插入文本时,会出现以下错误Javascript CKEditor未定义,javascript,asp.net,ckeditor,Javascript,Asp.net,Ckeditor,我已添加到我的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" %> &
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>
我做错了什么?尝试在标记中设置
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"} };
注释掉文本插入脚本,然后将其设置为开始;-) 你想干什么?设置默认内容?@MikeSmithDev我需要做的是,从按钮单击插入一些文本到CKEditor:实际上,CKEditor在我的项目中工作得很好,但当我尝试从javascript插入文本时,会出现错误…@Nalaka526您是正确的,但您的javascript位于错误的位置,与在特定索引处插入无关。@MikeSmithDev我从
PageLoad
到按钮单击
,这样它就有了一个光标位置来插入文本。我必须将javascript移动到哪里?
CKEditor1.config.toolbar = new object[]
{
new object[] { "Bold", "Italic", "Underline", "Strike", "-", "Cut",
"Copy", "Paste", "PasteText", "-", "NumberedList", "BulletedList",
"-", "Outdent", "Indent", "Blockquote", "-", "JustifyLeft",
"JustifyCenter", "JustifyRight", "JustifyBlock"} };