我的开发环境是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页面是怎么配置
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文件中验证当前登录身份。
<textarea id="FCKeditor_1" name="FCKeditor_1">
把这个代码加到你的script标签下面