首页 新闻 会员 周边

fckeditor配置

0
悬赏园豆:15 [已解决问题] 解决于 2014-06-09 11:46

我的开发环境是asp.net

现在有一个页面

<!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>
    <title></title>
    <script src="../fckeditor/fckeditor.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1">
        <script type="text/javascript">
            var oFCKeditor = new FCKeditor('FCKeditor_1');
            oFCKeditor.BasePath = '/fckeditor/';
            oFCKeditor.Height = 100;
            oFCKeditor.Config['ToolbarLocation'] = 'Out:xToolbar';
            oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.';
            oFCKeditor.Create();
        </script>
        <input type="button" value="提交" />
    </form>
</body>
</html>

运行时就是不会出现工具栏

在asp.net页面是可以正常用运行的,请问到了html页面是怎么配置

生活还是要继续的主页 生活还是要继续 | 初学一级 | 园豆:10
提问于:2014-06-08 13:14
< >
分享
最佳答案
0

1、配置问题

将JavaScript集成模块脚本放入<head>标签中
<script type="text/javascript" src="fckeditor/fckeditor.js"></script> 


方法一:
注意顺序
<textarea name="FCKeditor1" id="FCKeditor1"></textarea>
<script>    
var oFCKeditor = new FCKeditor('FCKeditor1');   
oFCKeditor.BasePath = "fckeditor/";    
oFCKeditor.Create();    
</script>


方法二:(替代<textarea>)
在<head>标签中添加onload方法  

Html代码
<script>    
window.onload = function()    
{    
var oFCKeditor = new FCKeditor( 'MyTextarea' ) ;    
oFCKeditor.BasePath = "fckeditor/" ;    
oFCKeditor.ReplaceTextarea() ;    
}    
</script>  

在<body>标签中添加以下代码

Html代码
<textarea id="MyTextarea" name="MyTextarea">    
This is <b>the</b> initial value.   
</textarea>

2、建议使用kindeditor编辑器,因fckeditor存在在安全性问题,只在fck下面的一个config.ascx文件中验证当前登录身份。

收获园豆:10
智伟 | 菜鸟二级 |园豆:266 | 2014-06-08 14:57
其他回答(1)
0


<textarea id="FCKeditor_1" name="FCKeditor_1">    

把这个代码加到你的script标签下面

收获园豆:5
刘宏玺 | 园豆:14020 (专家六级) | 2014-06-08 18:49
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册