2个回答
展开全部
首先要在网上下载到FCKeditor解压包,解压后去掉不相关的文件,如ASP等,可以压缩文件大小。将FCKeditor目录放在网站根目录.
在配置文件fckconfig.js中,将
FCKConfig.ToolbarSets["Default"] = [
['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;
改为
FCKConfig.ToolbarSets["Default"] = ['Smiley'];
只保留表情功能,然后建立调试页面test.php调用编辑器:
<?php
//包含fckeditor类
include("/fckeditor/fckeditor.php") ;
//创建一个FCKeditor,表单名称为 jzleditor
$oFCKeditor = new FCKeditor("jzleditor");
//设置编辑器路径
$oFCKeditor->BasePath = "/fckeditor/";
$oFCKeditor->ToolbarSet = "Default";//工具按钮
$oFCKeditor->Value =$cont; //;设置初始内容
$oFCKeditor->Width="100%"; //设置它的宽度
$oFCKeditor->Height="550px"; //设置它的高度
$oFCKeditor->Create();
?>
在配置文件fckconfig.js中,将
FCKConfig.ToolbarSets["Default"] = [
['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;
改为
FCKConfig.ToolbarSets["Default"] = ['Smiley'];
只保留表情功能,然后建立调试页面test.php调用编辑器:
<?php
//包含fckeditor类
include("/fckeditor/fckeditor.php") ;
//创建一个FCKeditor,表单名称为 jzleditor
$oFCKeditor = new FCKeditor("jzleditor");
//设置编辑器路径
$oFCKeditor->BasePath = "/fckeditor/";
$oFCKeditor->ToolbarSet = "Default";//工具按钮
$oFCKeditor->Value =$cont; //;设置初始内容
$oFCKeditor->Width="100%"; //设置它的宽度
$oFCKeditor->Height="550px"; //设置它的高度
$oFCKeditor->Create();
?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
<?php
function get_ubb($str) {
$str = preg_replace("/(\[)em(.*?)(\])/i", "<img src=\"em/\\2.gif\" />", $str);
return $str;
}
if($_POST['sub']){
echo get_ubb($_POST[message]);
}
?>
<script>
function inserttag(topen,tclose){
var themess = document.getElementById('con');//编辑对象
themess.focus();
if (document.selection) {//如果是否ie浏览器
var theSelection = document.selection.createRange().text;//获取选区文字
//alert(theSelection);
if(theSelection){
document.selection.createRange().text = theSelection = topen+theSelection+tclose;//替换
}else{
document.selection.createRange().text = topen+tclose;
}
theSelection='';
}else{//其他浏览器
var scrollPos = themess.scrollTop;
var selLength = themess.textLength;
var selStart = themess.selectionStart;//选区起始点索引,未选择为0
var selEnd = themess.selectionEnd;//选区终点点索引
if (selEnd <= 2)
selEnd = selLength;
var s1 = (themess.value).substring(0,selStart);//截取起始点前部分字符
var s2 = (themess.value).substring(selStart, selEnd)//截取选择部分字符
var s3 = (themess.value).substring(selEnd, selLength);//截取终点后部分字符
themess.value = s1 + topen + s2 + tclose + s3;//替换
themess.focus();
themess.selectionStart = newStart;
themess.selectionEnd = newStart;
themess.scrollTop = scrollPos;
return;
}
}
</script>
<hr/>
<font size=2>
<img src="em/0.gif" onclick='inserttag("[em0","]");' />
<img src="em/1.gif" onclick='inserttag("[em1","]");' />
<img src="em/2.gif" onclick='inserttag("[em2","]");' />
<img src="em/3.gif" onclick='inserttag("[em3","]");' />
<img src="em/4.gif" onclick='inserttag("[em4","]");' />
<img src="em/5.gif" onclick='inserttag("[em5","]");' />
<img src="em/6.gif" onclick='inserttag("[em6","]");' />
<img src="em/7.gif" onclick='inserttag("[em7","]");' />
<img src="em/8.gif" onclick='inserttag("[em8","]");' />
<img src="em/9.gif" onclick='inserttag("[em9","]");' />
<form action="" method="post">
<textarea name="message" id="con" cols="70%" rows="10"></textarea><br>
<input type="submit" name="sub" value="提交"/>
</form>
表情放在em文件夹下面
QQ:706561147
function get_ubb($str) {
$str = preg_replace("/(\[)em(.*?)(\])/i", "<img src=\"em/\\2.gif\" />", $str);
return $str;
}
if($_POST['sub']){
echo get_ubb($_POST[message]);
}
?>
<script>
function inserttag(topen,tclose){
var themess = document.getElementById('con');//编辑对象
themess.focus();
if (document.selection) {//如果是否ie浏览器
var theSelection = document.selection.createRange().text;//获取选区文字
//alert(theSelection);
if(theSelection){
document.selection.createRange().text = theSelection = topen+theSelection+tclose;//替换
}else{
document.selection.createRange().text = topen+tclose;
}
theSelection='';
}else{//其他浏览器
var scrollPos = themess.scrollTop;
var selLength = themess.textLength;
var selStart = themess.selectionStart;//选区起始点索引,未选择为0
var selEnd = themess.selectionEnd;//选区终点点索引
if (selEnd <= 2)
selEnd = selLength;
var s1 = (themess.value).substring(0,selStart);//截取起始点前部分字符
var s2 = (themess.value).substring(selStart, selEnd)//截取选择部分字符
var s3 = (themess.value).substring(selEnd, selLength);//截取终点后部分字符
themess.value = s1 + topen + s2 + tclose + s3;//替换
themess.focus();
themess.selectionStart = newStart;
themess.selectionEnd = newStart;
themess.scrollTop = scrollPos;
return;
}
}
</script>
<hr/>
<font size=2>
<img src="em/0.gif" onclick='inserttag("[em0","]");' />
<img src="em/1.gif" onclick='inserttag("[em1","]");' />
<img src="em/2.gif" onclick='inserttag("[em2","]");' />
<img src="em/3.gif" onclick='inserttag("[em3","]");' />
<img src="em/4.gif" onclick='inserttag("[em4","]");' />
<img src="em/5.gif" onclick='inserttag("[em5","]");' />
<img src="em/6.gif" onclick='inserttag("[em6","]");' />
<img src="em/7.gif" onclick='inserttag("[em7","]");' />
<img src="em/8.gif" onclick='inserttag("[em8","]");' />
<img src="em/9.gif" onclick='inserttag("[em9","]");' />
<form action="" method="post">
<textarea name="message" id="con" cols="70%" rows="10"></textarea><br>
<input type="submit" name="sub" value="提交"/>
</form>
表情放在em文件夹下面
QQ:706561147
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询