黑松山资源网 Design By www.paidiu.com
先我们看最简单的就是编辑器的代码了,简单得很同时大家也经常看过。
复制代码 代码如下:
<script type="text/javascript" src="/UploadFiles/2021-04-02/fckeditor.js"><script type="text/javascript">
<!--
var oFCKeditor = new FCKeditor( 'Content' ) ;
oFCKeditor.BasePath = "/editor/" ;
oFCKeditor.ToolbarSet = "User" ;
oFCKeditor.Value = '没有最好,只有更好,大家努力' ;
oFCKeditor.Height = 450 ;
oFCKeditor.Width = 660 ;
oFCKeditor.Create() ;
//-->
</script>
<input type="button" value="检测字数(包括HTML代码)" style="width:165px;" class="inputc" onClick="checklength()">
<script>
//检测在线编器字符数 ,他必须通过创建FCKeditorAPI来实现,代码如下。
复制代码 代码如下:
function checklength()
{
var Content;
var oEditor = FCKeditorAPI.GetInstance('Content') ;
Content=oEditor.GetXHTML(true)
alert("n当前: "+Content.length+" 个字符");
return false;
}
</script>
再看实例,这里限制了fckeditor编辑器内容的长度哦,
复制代码 代码如下:
window.onload=function(){
function FCKeditor_OnComplete()
{
var editor = FCKeditorAPI.GetInstance('info') ;
editor.Events.AttachEvent('OnSelectionChange', editor_keydown);
}
function editor_keydown(editor)
{
var maxLength=3; //最大输入字数
content= $(editor.EditorDocument.body).text();
var len= content.length;
var $info =$('#info');//存放提示信息
if(len < maxLength){
.text("还可以输入 "+(maxLength-len)+"字");
}
if(len == maxLength){
$info.text("字数达到上限");
}
if(len > maxLength){
$info.text(" 输入字符超过"+maxLength+"个,请更改!");
}
}
FCKeditor_OnComplete()
}
复制代码 代码如下:
<script type="text/javascript" src="/UploadFiles/2021-04-02/fckeditor.js"><script type="text/javascript">
<!--
var oFCKeditor = new FCKeditor( 'Content' ) ;
oFCKeditor.BasePath = "/editor/" ;
oFCKeditor.ToolbarSet = "User" ;
oFCKeditor.Value = '没有最好,只有更好,大家努力' ;
oFCKeditor.Height = 450 ;
oFCKeditor.Width = 660 ;
oFCKeditor.Create() ;
//-->
</script>
<input type="button" value="检测字数(包括HTML代码)" style="width:165px;" class="inputc" onClick="checklength()">
<script>
//检测在线编器字符数 ,他必须通过创建FCKeditorAPI来实现,代码如下。
复制代码 代码如下:
function checklength()
{
var Content;
var oEditor = FCKeditorAPI.GetInstance('Content') ;
Content=oEditor.GetXHTML(true)
alert("n当前: "+Content.length+" 个字符");
return false;
}
</script>
再看实例,这里限制了fckeditor编辑器内容的长度哦,
复制代码 代码如下:
window.onload=function(){
function FCKeditor_OnComplete()
{
var editor = FCKeditorAPI.GetInstance('info') ;
editor.Events.AttachEvent('OnSelectionChange', editor_keydown);
}
function editor_keydown(editor)
{
var maxLength=3; //最大输入字数
content= $(editor.EditorDocument.body).text();
var len= content.length;
var $info =$('#info');//存放提示信息
if(len < maxLength){
.text("还可以输入 "+(maxLength-len)+"字");
}
if(len == maxLength){
$info.text("字数达到上限");
}
if(len > maxLength){
$info.text(" 输入字符超过"+maxLength+"个,请更改!");
}
}
FCKeditor_OnComplete()
}
黑松山资源网 Design By www.paidiu.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
黑松山资源网 Design By www.paidiu.com
暂无评论...
更新日志
2024年05月20日
2024年05月20日
- 咏月风雅公测福利大全 有哪些奖励
- dnf装备成长攻略
- 鸣潮丹瑾适配武器选什么 丹瑾四星五星武器推荐
- dnf装备指令输入怎么输入
- 《对马岛之魂》超越《战神4》成为PC最火爆PS游戏!
- 《生化1 重制版》首批细节曝光!击杀敌人要更多子弹
- 国产游戏崛起!这款海外乱杀的国产游戏《七日世界》 要来了
- 阿杜.2003-哈啰【海蝶】【WAV+CUE】
- 群星1990-国语畅销金榜第7集[日本版][WAV+CUE]
- 陈凡骐.2024-陈凡骐首张同名创作专辑【FLAC分轨】
- 《黑神话:悟空》官网新图 老猴子手捧金箍
- 国外玩家谈《黑神话:悟空》定价:别是70美元
- 晨报|《全境封锁:腹地》实机视频泄露 《对马岛之魂》PC玩家数破纪录
- Supper.Moment.2020-Everything.Is.You【寰亚】【WAV+CUE】
- 张美玲.1999-福建不朽民谣【南方】【WAV+CUE】