由于在原表单已添加了一个表单域,再用fckeditor创建了一个同名的表单域,提交时就出现了逗号。如下:
<textarea name="Content"></textarea>
< type="text/java">
var oFCKeditor = new FCKeditor( 'Content') ;
oFCKeditor.BasePath = '/';
oFCKeditor.ToolbarSet = 'Default' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '400' ;
oFCKeditor. = '' ;
oFCKeditor.Create();
</>
如上,由于已存在一个名为Content的文本域,随后又用fckeditor的Create方法创建了一个名为Content的文本域,提交表单后就会出现逗号的问题。在一个表单中,通过给FCKeditor创建的文本域赋予初始值,就可以把发布的内容取回来再编辑,同样需要处理同名的表单域(文本域)引起的这个逗号问题,否则每编辑一次,就会增加一个逗号。
解决方法1:
使用上面的JS创建,并且把<textarea name="Content"></textarea>去掉即可。使用ASP和别的方法创建, 这个方法同样适用。
解决方法2:
将上面代码中的oFCKeditor.Create()换成oFCKeditor.ReplaceTextarea()。
避免出现逗号的ASP创建案例
如果想以后修改参考, 可以把原来的文本域注释如下:
<!-- 加了FCK,把这个注释掉, 否则出错<textarea name="texing" cols="70" rows="6" style="display:none"></textarea> -->
虽然风格设置为 style="display:none", 页面上已经不显示内容, 但这个文本域还是起作用的, 因此, 逗号照常出现, 必须注释, 才能解决这个问题。
发布信息的处理
<%
Dim aFCKeditor
Set aFCKeditor = New FCKeditor
aFCKeditor.BasePath = "../FCKeditor/" //设置编辑器的路径,我站点根目录下的一个目录
aFCKeditor.ToolbarSet = "Basic"
aFCKeditor.Width = "100%"
aFCKeditor.Height = "100"
aFCKeditor. = "" //这个是给编辑器初始值
aFCKeditor.Create "power" //以后编辑器里的内容都是由这个logbody取得,命名由你定
%>
<!-- 加了FCK,把这个注释掉, 否则出错<textarea name="power" cols="70" rows="10" style="display:none"></textarea>-->
编辑信息的处理
<%
Dim aFCKeditor
Set aFCKeditor = New FCKeditor
aFCKeditor.BasePath = "../FCKeditor/" //设置编辑器的路径,我站点根目录下的一个目录
aFCKeditor.ToolbarSet = "Basic"
aFCKeditor.Width = "100%"
aFCKeditor.Height = "150"
aFCKeditor. = power //这个是给编辑器初始值
aFCKeditor.Create "power" //以后编辑器里的内容都是由这个logbody取得,命名由你定
%>
<!-- 加了FCK,把这个注释掉, 否则出现多余逗号 <textarea name="power" cols="70" rows="10">< %=power%></textarea> % 前面多了空格 -->