日期:2014-05-16  浏览次数:20276 次

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

<!-- #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>

------解决方案--------------------
。。不是刚发过这样的贴么。。

看API应该是

FCKeditorAPI.GetInstance(‘articlecontent′).SetHTML(FCKeditorAPI.GetInstance('articlecontent').GetXHTML(true) + "这是新增加的内容");


FCKeditorAPI.GetInstance方法第一个参数就是oFCKeditor.Create "articlecontent"这里的引号里的内容了。

你仔细看生成的HTML文件就可以看到,InstanceName=articlecontent,所以可以通过GetInstance来获取。。