我是这样引入ckeditor的:
<textarea class="textbox" name="i_value" id="content_area" style="width:400px; height:120px;" runat="server">
<script type="text/javascript">
window.onload = function () {
var editor = CKEDITOR.replace('content_area');
}
</script>
详细点方法 最好有代码
给你借鉴一下,新闻发布:
News_add.asp页面代码
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top">
<table width="95%" border="0" cellpadding="2" cellspacing="1" class="table_southidc">
<form method="POST" name="myform" onSubmit="return CheckForm();" action="News_save.asp?action=Add" target="_self">
<tr align="center">
<td class="back_southidc" height="30" colspan="2"><font color="#0000FF"><strong>新增新闻</strong></font></td>
</tr>
<tr bgcolor="#ECF5FF">
<td width="20%" height="24" align="right"><div align="left"><font color="#FF0000">*</font>新
闻标题:</div></td>
<td width="80%" valign="top">
<div align="left">
<input name="title" type="text" class="input" value="" size="50" maxlength="200">
</div></td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left"><font color="#FF0000">*</font>新闻类别:</div></td>
<td valign="top">
新闻大类:
<%
set rs= Server.CreateObject("ADODB.Recordset")
sql = "select * from BigClass_New"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
else
%>
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<option selected value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
dim selclass
selclass=rs("BigClassName")
rs.movenext
do while not rs.eof
%>
<option value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
<select name="SmallClassName">
<option value="" selected>不指定小类</option>
<%
set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from SmallClass_New where BigClassName='" & selclass & "'"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td align="right" valign="top"><div align="left"><font color="#FF0000">*</font>新闻内容:</div></td>
<td valign="top">
<input type="hidden" name="content" value="">
<iframe ID="eWebEditor1" src="Southidceditor/ewebeditor.asp?id=content&style=southidc" frameborder="0" scrolling="no" width="620" HEIGHT="405"></iframe>
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left">首页图片:
<input name="IncludePic" type="hidden" id="IncludePic" value="yes">
</div></td>
<td valign="top"><input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="" size="50" maxlength="200">
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left"><font color="#FF0000">*</font>发布人:</div></td>
<td valign="top">
<div align="left">
<input name="user" type="text" class="input" size="30" value="admin">
</div></td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left">首页图片新闻:</div></td>
<td>
<div align="left">
<input type="radio" value="true" name="OK">
是
<input type="radio" value="false" checked name="Ok">
否 <font color="#FF0000">(设为首页图片新闻,选择此项时请注意文章中是否添加有图片!)</font></div></td>
</tr>
<tr align="center" bgcolor="#ECF5FF">
<td height="35"><div align="left">录入时间:</div></td>
<td height="35"><div align="left">
<input name="AddDate" type="text" id="AddDate" value="<%=date()%>" maxlength="50">
</div></td>
</tr>
<tr align="center" bgcolor="#ECF5FF">
<input type="hidden" name="Id" value="108">
<td height="35" colspan="2"> <input type="submit" name="Submit" value="提交" class="input">
<input type="reset" name="Submit" value="重置" class="input"> </td>
</tr>
</form>
</table>
</tr>
</table>
<table width="100%" height="28" border="0" cellpadding="0" cellspacing="0" class="HeaderTdStyle">
<tr>
<td>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td align="right">Design By <a href="mailto:sales@zhongxinkeji.com">ZXKJ</a></td>
</tr>
</table></td>
</tr>
</table>
处理页面News_save.asp代码:
<!--#include file="conn.asp"-->
<%
if Request.QueryString("action")="Add" then
set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from News"
rs.open sql,conn,1,3
If request.form("Title")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入标题,请返回检查!!"");history.go(-1);</script>")
response.end
end if
If request.form("content")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入新闻内容,请返回检查!!"");history.go(-1);</script>")
response.end
end if
If request.form("user")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入发布人,请返回检查!!"");history.go(-1);</script>")
response.end
end if
rs.addnew
rs("Title")=request.form("Title")
rs("Content")=request.form("content")
rs("BigClassName")=request.form("BigClassName")
rs("SmallClassName")=request.form("SmallClassName")
rs("FirstImageName")=request.form("DefaultPicUrl")
rs("User")=request.form("user")
rs("AddDate")=request.form("AddDate")
rs("Ok")=request.form("Ok")
rs.update
rs.close
set rs=nothing
response.Redirect "News_Manage.asp"
end if
%>
News_add.asp页面代码
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top">
<table width="95%" border="0" cellpadding="2" cellspacing="1" class="table_southidc">
<form method="POST" name="myform" onSubmit="return CheckForm();" action="News_save.asp?action=Add" target="_self">
<tr align="center">
<td class="back_southidc" height="30" colspan="2"><font color="#0000FF"><strong>新增新闻</strong></font></td>
</tr>
<tr bgcolor="#ECF5FF">
<td width="20%" height="24" align="right"><div align="left"><font color="#FF0000">*</font>新
闻标题:</div></td>
<td width="80%" valign="top">
<div align="left">
<input name="title" type="text" class="input" value="" size="50" maxlength="200">
</div></td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left"><font color="#FF0000">*</font>新闻类别:</div></td>
<td valign="top">
新闻大类:
<%
set rs= Server.CreateObject("ADODB.Recordset")
sql = "select * from BigClass_New"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
else
%>
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<option selected value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
dim selclass
selclass=rs("BigClassName")
rs.movenext
do while not rs.eof
%>
<option value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
<select name="SmallClassName">
<option value="" selected>不指定小类</option>
<%
set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from SmallClass_New where BigClassName='" & selclass & "'"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td align="right" valign="top"><div align="left"><font color="#FF0000">*</font>新闻内容:</div></td>
<td valign="top">
<input type="hidden" name="content" value="">
<iframe ID="eWebEditor1" src="Southidceditor/ewebeditor.asp?id=content&style=southidc" frameborder="0" scrolling="no" width="620" HEIGHT="405"></iframe>
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left">首页图片:
<input name="IncludePic" type="hidden" id="IncludePic" value="yes">
</div></td>
<td valign="top"><input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="" size="50" maxlength="200">
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left"><font color="#FF0000">*</font>发布人:</div></td>
<td valign="top">
<div align="left">
<input name="user" type="text" class="input" size="30" value="admin">
</div></td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left">首页图片新闻:</div></td>
<td>
<div align="left">
<input type="radio" value="true" name="OK">
是
<input type="radio" value="false" checked name="Ok">
否 <font color="#FF0000">(设为首页图片新闻,选择此项时请注意文章中是否添加有图片!)</font></div></td>
</tr>
<tr align="center" bgcolor="#ECF5FF">
<td height="35"><div align="left">录入时间:</div></td>
<td height="35"><div align="left">
<input name="AddDate" type="text" id="AddDate" value="<%=date()%>" maxlength="50">
</div></td>
</tr>
<tr align="center" bgcolor="#ECF5FF">
<input type="hidden" name="Id" value="108">
<td height="35" colspan="2"> <input type="submit" name="Submit" value="提交" class="input">
<input type="reset" name="Submit" value="重置" class="input"> </td>
</tr>
</form>
</table>
</tr>
</table>
<table width="100%" height="28" border="0" cellpadding="0" cellspacing="0" class="HeaderTdStyle">
<tr>
<td>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td align="right">Design By <a href="mailto:sales@zhongxinkeji.com">ZXKJ</a></td>
</tr>
</table></td>
</tr>
</table>
处理页面News_save.asp代码:
<!--#include file="conn.asp"-->
<%
if Request.QueryString("action")="Add" then
set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from News"
rs.open sql,conn,1,3
If request.form("Title")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入标题,请返回检查!!"");history.go(-1);</script>")
response.end
end if
If request.form("content")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入新闻内容,请返回检查!!"");history.go(-1);</script>")
response.end
end if
If request.form("user")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入发布人,请返回检查!!"");history.go(-1);</script>")
response.end
end if
rs.addnew
rs("Title")=request.form("Title")
rs("Content")=request.form("content")
rs("BigClassName")=request.form("BigClassName")
rs("SmallClassName")=request.form("SmallClassName")
rs("FirstImageName")=request.form("DefaultPicUrl")
rs("User")=request.form("user")
rs("AddDate")=request.form("AddDate")
rs("Ok")=request.form("Ok")
rs.update
rs.close
set rs=nothing
response.Redirect "News_Manage.asp"
end if
%>
温馨提示:答案为网友推荐,仅供参考
第1个回答 2011-01-11
只不过是一个回调函数而已,参考ckeditor的jQuery代码写出一下代码,经测试可用。至于你用什么上传随你,只要记得回调window.parent.CKEDITOR.tools.callFunction,具体可参考网站文档。
(function(){
var oCKeditor = CKEDITOR.replace( 'Content');
oCKeditor.config.Savepathfilename = "upFiles" ;
oCKeditor.on( 'instanceReady', function( event )
{
var editor = event.editor;
setTimeout( function()
{
// Delay bit more if editor is still not ready.
if ( !editor.element )
{
setTimeout( arguments.callee, 100 );
return;
}
event.removeListener( 'instanceReady', this.callee );
if ( editor.name == 'Content' )
{
var bFilebrowserFn = editor._.filebrowserFn;
var setUploadFileck=function(a,b){
var b=parent.document.getElementById(editor.config.Savepathfilename);
if(b && !!a)
if(b.value.indexOf(a)==-1){
if(b.value!=='')b.value=b.value+'|'+a;
else b.value=a;
if(b.onchange)b.onchange();
}
CKEDITOR.tools.callFunction(bFilebrowserFn, a, b);
};
editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUploadFileck, editor );
}
}, 0 );
}, null, null, 9999);
})();
(function(){
var oCKeditor = CKEDITOR.replace( 'Content');
oCKeditor.config.Savepathfilename = "upFiles" ;
oCKeditor.on( 'instanceReady', function( event )
{
var editor = event.editor;
setTimeout( function()
{
// Delay bit more if editor is still not ready.
if ( !editor.element )
{
setTimeout( arguments.callee, 100 );
return;
}
event.removeListener( 'instanceReady', this.callee );
if ( editor.name == 'Content' )
{
var bFilebrowserFn = editor._.filebrowserFn;
var setUploadFileck=function(a,b){
var b=parent.document.getElementById(editor.config.Savepathfilename);
if(b && !!a)
if(b.value.indexOf(a)==-1){
if(b.value!=='')b.value=b.value+'|'+a;
else b.value=a;
if(b.onchange)b.onchange();
}
CKEDITOR.tools.callFunction(bFilebrowserFn, a, b);
};
editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUploadFileck, editor );
}
}, 0 );
}, null, null, 9999);
})();
第2个回答 2011-01-11
ckeditor 本身不带上传功能 ,,需要集合使用ckfinder 。本回答被提问者采纳
第3个回答 2011-01-10
在fckeditor/editor/filemanager/connectors目录下有很多的文件夹,根据你网站程序的编写语言选一个进去后,就是上传功能的文件了
第4个回答 2015-07-31
编辑器 都带有 插入图片的功能