本来想在ASP.NET 2.0中使用FCKEditorAPI中提供的InsertHTML()函数,但是我在使用过程中浏览器会报告 FCKEditorAPI 未定义的错误,请问如何解决?我使用的代码如下:
protected void InsertAttachmentHTML()
{
String csName = "Insertpic1";
Type csType = GetType();
ClientScriptManager cs = Page.ClientScript;
if (!cs.IsStartupScriptRegistered(csType, csName))
{
//FCKeditor1
string cstext1 =
@"var oEditor = FCKeditorAPI.GetInstance(FCKeditor1);
oEditor.InsertHtml('<img src=http: //www.baidu.com/img/logo.gif/>');"; cs.RegisterStartupScript(csType, csName, cstext1, true);
}
}//sMsg是返回的提示信息,myPage是当前页
//调用这个函数就可以了
protected void btnUploadFile_Click(object sender, EventArgs e)
{
InsertAttachmentHTML();
}