浅析UBB编辑器
2019-05-16 23:59:26来源:爱站网 阅读 ()
我们在做bbs项目的时候就需要用到ubb编辑器,后台管理人员一般使用的是CKEditor编辑器,网友们用的一般是ubb编辑器,很多人对ubb编辑器都不是非常的了解,下面就是爱站小编为大家浅析UBB编辑器。
<!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN"?"' target=_blank rel=nofollow>http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>UBB编辑器</title>
<meta?http-equiv="Content-Type"?content="text/html;?charset=gb2312">
<link?href="style.css"?rel="stylesheet"?type="text/css">
<script?language="JavaScript">
<!--
if(navigator.appName?==?"Microsoft?Internet?Explorer")
{
????isIE=true;
}
else
{
????isIE=false;
}
function?AddText(NewCode)?
{
????if(document.all){
????????insertAtCaret(document.ubbform.Content,?NewCode);
????????document.ubbform.Content.focus();
????}
????else
????{
????????document.ubbform.Content.value?+=?NewCode;
????????document.ubbform.Content.focus();
????}
}
function?insertAtCaret?(textEl,?text){
????if?(textEl.createTextRange?&&?textEl.caretPos)
????{
????????var?caretPos?=?textEl.caretPos;
????????caretPos.text?+=?caretPos.text.charAt(caretPos.text.length?-?2)?==?'?'???text?+?'?'?:?text;
????}
????else?if(textEl)
????{
????????textEl.value?+=?text;
????}
????else
????{
????????textEl.value?=?text;
????}
}
function?ubbFormat(what)?
{
????if?(document.selection?&&?document.selection.type?==?"Text")
????{
????????var?range?=?document.selection.createRange();
????????range.text?=?"["+what+"]"?+?range.text?+?"[/"+what+"]";
????}
????else
????{
????????txt=window.prompt("请输入内容","");?????
????????if?(txt!=null)?{???????????
????????????????AddTxt="["+what+"]"+txt;
????????????????AddText(AddTxt);
????????????????AddText("[/"+what+"]");
????????}???????
????}?
}
function?ubbInsert(what)?
{
????if?(document.selection?&&?document.selection.type?==?"Text")
????{
????????var?range?=?document.selection.createRange();
????????range.text?=?"["+what+"]"?+?range.text?+?"[/"+what+"]";
????}
????else
????{
????????txt=window.prompt("请输入内容","");?????
????????if?(txt!=null)?{???????????
????????????????AddTxt="["+what+"]"+txt;
????????????????AddText(AddTxt);
????????????????AddText("[/"+what+"]");
????????}???????
????}?
}
function?chsize(size)?{
????if?(document.selection?&&?document.selection.type?==?"Text")
????{
????????var?range?=?document.selection.createRange();
????????range.text?=?"[size="?+?size?+?"]"?+?range.text?+?"[/size]";
????}
????else
????{???????????????????????
????????txt=window.prompt("请输入内容","");?
????????if?(txt!=null)
????????{?????????????
????????????AddTxt="[size="+size+"]"+txt;
????????????AddText(AddTxt);
????????????AddText("[/size]");
????????}????????
????}
}
function?chfont(font)?{
????if?(document.selection?&&?document.selection.type?==?"Text")?{
????var?range?=?document.selection.createRange();
????range.text?=?""?+?range.text?+?"";
????}
????else
????{??????????????????
????????txt=window.prompt("请输入内容","");
????????if?(txt!=null)
????????{?????????????
????????????AddTxt=""+txt;
????????????AddText(AddTxt);
????????????AddText("");
????????}????????
????}??
}
function?chcolor(color)?{
????if?(document.selection?&&?document.selection.type?==?"Text")?{
????var?range?=?document.selection.createRange();
????range.text?=?""?+?range.text?+?"";
????}
????else
????{??
????txt=window.prompt("请输入内容","");
????????if(txt!=null)?{
????????????AddTxt=""+txt;
????????????AddText(AddTxt);
????????????AddText("");
????????}
????}
}
//-->
</script>
</head>
<body>
<form?method=post?name="ubbform"?action="">
<table?align="center"?border="0">
<tr>
????<td>
????<select?name="font"?onFocus="this.selectedIndex=0"?onChange="chfont(this.options[this.selectedIndex].value)"?size="1">
????????<option?value=""?selected>选择字体</option>
????????<option?value="宋体">宋体</option>
????????<option?value="黑体">黑体</option>
????????<option?value="Arial">Arial</option>
????????<option?value="Book?Antiqua">Book?Antiqua</option>
????????<option?value="Century?Gothic">Century?Gothic</option>
????????<option?value="Courier?New">Courier?New</option>
????????<option?value="Georgia">Georgia</option>
????????<option?value="Impact">Impact</option>
????????<option?value="Tahoma">Tahoma</option>
????????<option?value="Times?New?Roman">Times?New?Roman</option>
????????<option?value="Verdana">Verdana</option>
????</select>
????<select?name="size"?onFocus="this.selectedIndex=0"?onChange="chsize(this.options[this.selectedIndex].value)"?size="1">
??????????<option?value=""?selected>字体大小</option>
??????????<option?value="-2">-2</option>
??????????<option?value="-1">-1</option>
??????????<option?value="1">1</option>
??????????<option?value="2">2</option>
??????????<option?value="3">3</option>
??????????<option?value="4">4</option>
??????????<option?value="5">5</option>
??????????<option?value="6">6</option>
??????????<option?value="7">7</option>
????</select>
????<select?name="color"??onFocus="this.selectedIndex=0"?onChange="chcolor(this.options[this.selectedIndex].value)"?size="1">
??????????<option?value=""?selected>字体颜色</option>
??????????<option?value="Black"?style="background-color:black;color:black;">Black</option>
??????????<option?value="White"?style="background-color:white;color:white;">White</option>
??????????<option?value="Red"?style="background-color:red;color:red;">Red</option>
??????????<option?value="Yellow"?style="background-color:yellow;color:yellow;">Yellow</option>
??????????<option?value="Pink"?style="background-color:pink;color:pink;">Pink</option>
??????????<option?value="Green"?style="background-color:green;color:green;">Green</option>
??????????<option?value="Orange"?style="background-color:orange;color:orange;">Orange</option>
??????????<option?value="Purple"?style="background-color:purple;color:purple;">Purple</option>
??????????<option?value="Blue"?style="background-color:blue;color:blue;">Blue</option>
??????????<option?value="Beige"?style="background-color:beige;color:beige;">Beige</option>
??????????<option?value="Brown"?style="background-color:brown;color:brown;">Brown</option>
??????????<option?value="Teal"?style="background-color:teal;color:teal;">Teal</option>
??????????<option?value="Navy"?style="background-color:navy;color:navy;">Navy</option>
??????????<option?value="Maroon"?style="background-color:maroon;color:maroon;">Maroon</option>
??????????<option?value="LimeGreen"?style="background-color:limegreen;color:limegreen;">LimeGreen</option>
????</select>
????</td>
</tr>
<tr>
????<td>
????<img?src="ubb/bold.gif"?border="0"?alt="粗体"?onClick="ubbFormat('B')"><img?src="ubb/italicize.gif"?border="0"?alt="斜体"?onClick="ubbFormat('I')"><img?src="ubb/underline.gif"?border="0"?alt="下划线"?onClick="ubbFormat('U')"><img?src="ubb/center.gif"?border="0"?alt="居中对齐"?onClick="ubbFormat('CENTER')"><img?src="ubb/email.gif"?border="0"?alt="插入EMAIL地址"?onClick="ubbFormat('EMAIL')"><img?src="ubb/url.gif"?border="0"?alt="插入网址"?onClick="ubbFormat('URL')"><img?src="ubb/quote.gif"?border="0"?alt="引用内容"?onClick="ubbFormat('QUOTE')"><img?src="ubb/wmv.gif"?border="0"?alt="插入视频"?onClick="ubbFormat('MEDIA')"><img?src="ubb/flash.gif"?border="0"?alt="插入flash动画"?onClick="ubbInsert('FLASH')"><img?src="ubb/image.gif"?border="0"?alt="插入图片"?onClick="ubbInsert('IMG')">
????</td>
</tr>
<tr>
????<td><textarea?name="Content"?rows="10"?cols="80"></textarea></td>
</tr>
<tr>
????<td></td>
</tr>
</table>
</form>
</body>
</html>
以上就是浅析UBB编辑器的内容,希望对大家的学习有所帮助,也希望大家多多支持爱站技术频道。
原文链接:https://js.aizhan.com/develop/asp/6189.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:远程调用ACCESS数据库
下一篇:打造属于自己的搜索引擎
- asp之自动闭合HTML/ubb标签函数附简单注释 2020-02-24
- 浅析ASP之Global.asa的文件用法 2019-04-12
- 关于editplus的剪辑文件 2019-01-03
- 浅析 ASP.NET编程中的十大技巧 2009-05-12
- 一个简单好用的UBB编辑器(含代码) 2009-05-12
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash