如何写JS来改变FCKeditor编辑器输入框中的内容呢?在线等,急用。。

rings2000 2013-03-19 02:20:32

<!-- #include file="FCKeditor/FCKeditor.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用JS改变FCKeditor编辑器的值</title>
<script language="JavaScript">
<!--
function getpicdisc()
{
//这里如何写JS来改变编辑器输入框中的内容呢?例如在原来的值“1234”后面加入“这是新增加的内容”?
}
//-->
</script>
</head>
<body>
<form name="theForm" action="test2.asp" method="post" >
标题:<input type="input" name="addname" value="" /><br />
来源:<input type="input" name="articlefrom" value="" /><br />
<input type="button" value="插入图片" onclick="getpicdisc()"/><br>
<%

Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "FCKeditor/"
oFCKeditor.ToolbarSet = "Default"
oFCKeditor.Width = "100%"
oFCKeditor.Height = "400"
oFCKeditor.Value = "1234"
oFCKeditor.Create "articlecontent"
%>
<input type="submit" value="Submit" />
</form>
</body>
</html>
...全文
232 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
rings2000 2013-03-19
  • 打赏
  • 举报
回复

<!-- #include file="FCKeditor/FCKeditor.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用JS改变FCKeditor编辑器的值</title>
<script language="JavaScript">
<!--
function getpicdisc(imagesfiles)
{
FCKeditorAPI.GetInstance('disc').SetHTML(FCKeditorAPI.GetInstance('disc').GetXHTML(true) + "这是新增加的内容");
}
//-->
</script>
</head>
<body>
<form name="theForm" action="test2.asp" method="post" >
标题:<input type="input" name="addname" value="" /><br />
来源:<input type="input" name="articlefrom" value="" /><br />
<input type="button" value="插入图片"  onclick="getpicdisc()"/><br>
<%
Vir_dir = Request.ServerVariables("url")
Vir_shu = InStrRev(Vir_dir,"/")
Vir_dir = left(Vir_dir,Vir_shu-1)
response.Cookies("Vir_dir_cook") = Vir_dir
response.write request.Cookies("Vir_dir_cook")
'thisurl=request.ServerVariables("url")
'thisurl=replace(thisurl,"/index.asp","")
'response.write thisurl

 Dim oFCKeditor
 Set oFCKeditor = New FCKeditor
 oFCKeditor.BasePath = "FCKeditor/"
 oFCKeditor.ToolbarSet = "Default"
 oFCKeditor.Width = "100%"
 oFCKeditor.Height = "400"
 oFCKeditor.Value = "1234"
 oFCKeditor.Create "disc"
%>
<input type="submit" value="Submit" />
</form>
</body>
</html>

functionsub 2013-03-19
  • 打赏
  • 举报
回复
。。不是刚发过这样的贴么。。 看API应该是

FCKeditorAPI.GetInstance(‘articlecontent′).SetHTML(FCKeditorAPI.GetInstance('articlecontent').GetXHTML(true) + "这是新增加的内容");
FCKeditorAPI.GetInstance方法第一个参数就是oFCKeditor.Create "articlecontent"这里的引号里的内容了。 你仔细看生成的HTML文件就可以看到,InstanceName=articlecontent,所以可以通过GetInstance来获取。。
rings2000 2013-03-19
  • 打赏
  • 举报
回复
运行上面文件后的html源码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用JS改变FCKeditor编辑器的值</title>
<script language="JavaScript"> 
<!-- 
function getpicdisc() { 
//这里如何写JS来改变编辑器输入框中的内容呢?例如在原来的值“1234”后面加入“这是新增加的内容”? } 
//-->
</script>
</head>
<body>
<form name="theForm" action="test2.asp" method="post" >
标题:<input type="input" name="addname" value="" /><br />
来源:<input type="input" name="articlefrom" value="" /><br />
<input type="button" value="插入图片"  onclick="getpicdisc()"/><br>
<input type="hidden" id="articlecontent" name="articlecontent" value="1234" style="display:none" />
<input type="hidden" id="articlecontent___Config" value="" style="display:none" />
<iframe id="articlecontentFrame" src="FCKeditor/editor/fckeditor.html?InstanceName=articlecontent&Toolbar=Default" width="100%" height="400" frameborder="0" scrolling="no"></iframe>
<input type="submit" value="Submit" />
</form>
</body>
兼容目前的浏览器 里面包含FCKeditor编辑器和控件 一、集成方法 FCKeditor应用在ASP.NET上,需要两组文件,一组是FCKeditor本身,另一个是用于ASP.NET的FCKeditor控件(分为1.1和2.0两个版本,这里使用2.0版本)。 1. 将FCKeditor加入到项目 解压FCKeditor编辑器,得到文件夹fckeditor,复制此文件夹到Web应用的项目下(也可以是子孙目录下)。 解压FCKeditor控件,在其子目录bin/Release/2.0下有一个程序集。在Web应用的项目引用该程序集。 2. 在页面使用FCKeditor 有两种方式。 (1)手工编码 在页面加入ASP.NET指令: 然后在需要的地方加入FCKeditor控件: (2)集成到Visual Studio工具箱 打开一ASP.NET页面,展开Toolbox,打开右键菜单,选择“Choose Items ...”,在出现的“Choose Toolbox Items”会话框的“.NET Framework Components”选项卡选择“Browse”,找到并选FCKeditor程序集,打开后回到“Choose Toolbox Items”窗口,点击“OK”,完成控件导入。 这时,在Toolbox的General分类下出现了一个名为FCKeditor的控件,可以像使用Visual Studio内置控件一样使用它。 3. 配置FCKeditor编辑器路径 在页面,使用的是FCKeditor控件,该控件需要知道FCKeditor编辑器文件组的路径。有两种配置方法。 (1)配置web.config 在appSettings配置节加入 使用这种配置方法后,对于项目任何一个页面用到的FCKeditor控件,都不用再配置其BasePath属性。 (2)直接对用到的FCKeditor控件进行配置 在页面代码设置FCKeditor的属性BasePath为FCKeditor编辑器文件组的路径,或者在Page_Init事件处理器设置其BasePath的值。 4. 配置FCKeditor编辑器文件上传路径 在web.config的appSettings配置节加入 这样,就完成了FCKeditor向ASP.NET页面的集成工作。 二、配置FCKeditor 按照FCKeditor的默认配置,可以完成一些常用的HTML可视化编辑工作,但在实际应用,还需要对其做进一步的配置。FCKeditor控件的可配置属性不多,且配置后只能作用于一个单一实例。实际上,需要对FCKeditor编辑器文件组的通用配置文件/fckconfig.js和ASP.NET专用文件上传管理代码文件/editor/filemanager/connectors/aspx/config.ascx进行配置。 1. 配置控件语言 FCKeditor是自动探测浏览器所使用的语言编码的,其默认语言是英文。修改配置行"FCKConfig.DefaultLanguage = 'en';"为'zh-cn',采用文为默认语言。 2. 配置控件应用技术 FCKeditor默认是用于php技术的。修改配置行"var _FileBrowserLanguage = 'php';"和"var _QuickUploadLanguage = 'php';"为'aspx',采用ASP.NET技术。 3. 配置Tab键 默认Tab键在FCKeditor不可用,可以修改配置行"FCKConfig.TabSpaces = 0;"为1,启用Tab键。 4. 定制FCKe

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧