[已解决问题] 使用JS脚本操作FCKEditor控件时出的一个小问题
提问时间: 2008-06-24 14:50
悬赏分:5 浏览:222 次

最近在.net aspx页面上,在使用JS脚本对FCKEditor控件时,发现有以下情况:

问题出在:我在cs页面中可以使用txtReportDef.value给这个赋值,但是通过脚本赋值我用alert是抛出了正常所要的值,但是页面上txtReportDef文本区的值没有变化。

其中:lbSearchItem这个控件在cs页面邦定其值。

 1
 2<html>
 3<head>
 4  <script language="javascript">
 5  function()
 6  {
 7    var ddlItems=document.all("lbSearchItem");
 8    var selItemVal=ddlItems.options[ddlItems.selectedIndex].value; 
 9      document.all("txtReportDef").value += selItemVal;
10  }

11  </script>
12</head>
13<body>
14<form runat="server">
15 <fck:FCKeditor id="txtReportDef" runat="server" BasePath="~/Assistant/FCKeditor/" ToolbarStartExpanded="false" Height="100%"/>
16 <asp:ListBox ID="lbSearchItem" runat="server" Rows="19" Width="100%"></asp:ListBox>
17<input id="btn" name="submit" type="button" onclick="additem()"/>
18</form>
19</body>
提问者:Sunsky - 初学一级

问题补充:怎么敲出来都是乱码,第5行是函数 function additem(){

最佳答案
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %> <!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 runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div id="div1"> <FCKeditorV2:FCKeditor runat="server" ID="sss1" BasePath="FCKeditor/"></FCKeditorV2:FCKeditor> <input type="button" onclick="f()" value="add content to fck" /> </div> </form> <script type="text/javascript"> function f(){ var o=FCKeditorAPI.GetInstance("sss1"); o.EditorDocument.body.innerHTML += "Hi, <span style='color:green;font-weight:bold;font-size:25px'>竹子!</span>"; } </script> </body> </html>
2008/6/24 23:20:29 回答者:Povoz (Sean Lu)
评论
2个月前   Sunsky :
太感谢你了,真的 原来就是需要用它提供的那个API接口 艾 我从网上也找了,发现好多人说的不太直接呵呵!对了 你有这个控件的详细使用帮助么,给我个下载地址也行!
2个月前   Povoz (Sean Lu) :
我没见过比较系统的使用说明,你可以在cnblogs.com中找一找。
google: "fckeditor site:cnblogs.com" 可以找到很多。
   您需要登录以后才能回答!
 

我要提问

我的问题


快到期问题

> 问题排行榜

相关链接