首页 新闻 会员 周边 捐助

使用JS脚本操作FCKEditor控件时出的一个小问题

0
悬赏园豆:5 [已解决问题] 解决于 2008-06-25 15:31
<P>最近在.net aspx页面上,在使用JS脚本对FCKEditor控件时,发现有以下情况:</P> <P>问题出在:我在cs页面中可以使用<SPAN style="COLOR: #800000">txtReportDef.value<FONT color=#000000>给这个赋值,但是通过脚本赋值我用alert是抛出了正常所要的值,但是页面上<SPAN style="COLOR: #800000">txtReportDef<FONT color=#000000>文本区的值没有变化。</FONT></SPAN></FONT></SPAN></P> <P><SPAN style="COLOR: #800000"><SPAN style="COLOR: #800000"><FONT color=#000000>其中:<SPAN style="COLOR: #800000">lbSearchItem<FONT color=#000000>这个控件在cs页面邦定其值。</FONT></SPAN></FONT></SPAN></SPAN></P> <DIV class=cnblogs_code><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;2</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">html</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;3</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">head</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;4</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">script&nbsp;language</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">javascript</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;function()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_63_240_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_63_240_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_63_240_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_63_240_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top>&nbsp; </SPAN><SPAN id=Codehighlighter1_63_240_Open_Text><SPAN style="COLOR: #000000">{</SPAN></SPAN></DIV> <DIV class=cnblogs_code><SPAN><SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;ddlItems</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">document.all(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">lbSearchItem</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;selItemVal</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">ddlItems.options[ddlItems.selectedIndex].value;&nbsp;</SPAN></SPAN></DIV> <DIV class=cnblogs_code><SPAN><SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #008080">&nbsp;9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #000000">document.all(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">txtReportDef</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">).value&nbsp;</SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000">&nbsp;selItemVal;<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">script</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">head</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">body</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">form&nbsp;runat</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">server</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN></DIV> <DIV class=cnblogs_code><SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #008080">15 </SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">fck:FCKeditor&nbsp;id</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">txtReportDef</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;runat</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">server</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;BasePath</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">~/Assistant/FCKeditor/</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;ToolbarStartExpanded</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">false</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;Height</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">100%</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">16 </SPAN><SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">asp:ListBox&nbsp;ID</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">lbSearchItem</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;runat</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">server</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;Rows</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">19</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;Width</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">100%</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&gt;&lt;/</SPAN><SPAN style="COLOR: #000000">asp:ListBox</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">input&nbsp;id</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">btn</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;name</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">submit</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;type</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">button</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;onclick</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">additem()</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">form</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">19</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">body</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN></DIV>
问题补充: 怎么敲出来都是乱码,第5行是函数 function additem(){
Sunsky的主页 Sunsky | 初学一级 | 园豆:180
提问于:2008-06-24 14:50
< >
分享
最佳答案
0
<%@ 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>
Povoz (Sean Lu) | 菜鸟二级 |园豆:240 | 2008-06-24 23:20
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册