UBB编辑器

2018-09-06 11:20

阅读:557

  
<html>
<head>
<title>UBB编辑器</title>
<metahttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<linkhref=style.cssrel=stylesheettype=text/css>
<scriptlanguage=JavaScript>
<!--
if(navigator.appName==MicrosoftInternetExplorer)
{
isIE=true;
}
else
{
isIE=false;
}


functionAddText(NewCode)
{
if(document.all){
document.ubbform.Content.focus();
}
else
{
document.ubbform.Content.value+=NewCode;
document.ubbform.Content.focus();
}
}

functioninsertAtCaret(textEl,text){
if(textEl.createTextRange&&textEl.caretPos)
{
varcaretPos=textEl.caretPos;
caretPos.text+=caretPos.text.charAt(caretPos.text.length-2)==?text+:text;
}
elseif(textEl)
{
textEl.value+=text;
}
else
{
textEl.value=text;
}
}

functionubbFormat(what)
{
if(document.selection&&document.selection.type==Text)
{
varrange=document.selection.createRange();
range.text=[+what+]+range.text+[/+what+];
}
else
{
txt=window.prompt(请输入内容,);
if(txt!=null){
AddTxt=[+what+]+txt;
AddText(AddTxt);
AddText([/+what+]);
}
}
}

functionubbInsert(what)
{
if(document.selection&&document.selection.type==Text)
{
varrange=document.selection.createRange();
range.text=[+what+]+range.text+[/+what+];
}
else
{
txt=window.prompt(请输入内容,);
if(txt!=null){
AddTxt=[+what+]+txt;
AddText(AddTxt);
AddText([/+what+]);
}
}
}

functionchsize(size){
if(document.selection&&document.selection.type==Text)
{
varrange=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]);
}
}
}

functionchfont(font){
if(document.selection&&document.selection.type==Text){
varrange=document.selection.createRange();
range.text=+range.text+;
}
else
{
txt=window.prompt(请输入内容,);
if(txt!=null)
{
AddTxt=+txt;
AddText(AddTxt);
AddText();
}
}
}

functionchcolor(color){
if(document.selection&&document.selection.type==Text){
varrange=document.selection.createRange();
range.text=+range.text+;
}
else
{
txt=window.prompt(请输入内容,);
if(txt!=null){
AddTxt=+txt;
AddText(AddTxt);
AddText();
}
}
}

//-->
</script>
</head>
<body>
<formmethod=postname=ubbformaction=>
<tablealign=centerborder=0>
<tr>
<td>
<selectname=fontonFocus=this.selectedIndex=0onChange=chfont(this.options[this.selectedIndex].value)size=1>
<optionvalue=selected>选择字体</option>
<optionvalue=宋体>宋体</option>
<optionvalue=黑体>黑体</option>
<optionvalue=Arial>Arial</option>
<optionvalue=BookAntiqua>BookAntiqua</option>
<optionvalue=CenturyGothic>CenturyGothic</option>
<optionvalue=CourierNew>CourierNew</option>
<optionvalue=Georgia>Georgia</option>
<optionvalue=Impact>Impact</option>
<optionvalue=Tahoma>Tahoma</option>
<optionvalue=TimesNewRoman>TimesNewRoman</option>
<optionvalue=Verdana>Verdana</option>
</select>
<selectname=sizeonFocus=this.selectedIndex=0onChange=chsize(this.options[this.selectedIndex].value)size=1>
<optionvalue=selected>字体大小</option>
<optionvalue=-2>-2</option>
<optionvalue=-1>-1</option>
<optionvalue=1>1</option>
<optionvalue=2>2</option>
<optionvalue=3>3</option>
<optionvalue=4>4</option>
<optionvalue=5>5</option>
<optionvalue=6>6</option>
<optionvalue=7>7</option>
</select>
<selectname=coloronFocus=this.selectedIndex=0onChange=chcolor(this.options[this.selectedIndex].value)size=1>
<optionvalue=selected>字体颜色</option>
<optionvalue=Blackstyle=background-color:black;color:black;>Black</option>
<optionvalue=Whitestyle=background-color:white;color:white;>White</option>
<optionvalue=Redstyle=background-color:red;color:red;>Red</option>
<optionvalue=Yellowstyle=background-color:yellow;color:yellow;>Yellow</option>
<optionvalue=Pinkstyle=background-color:pink;color:pink;>Pink</option>
<optionvalue=Greenstyle=background-color:green;color:green;>Green</option>
<optionvalue=Orangestyle=background-color:orange;color:orange;>Orange</option>
<optionvalue=Purplestyle=background-color:purple;color:purple;>Purple</option>
<optionvalue=Bluestyle=background-color:blue;color:blue;>Blue</option>
<optionvalue=Beigestyle=background-color:beige;color:beige;>Beige</option>
<optionvalue=Brownstyle=background-color:brown;color:brown;>Brown</option>
<optionvalue=Tealstyle=background-color:teal;color:teal;>Teal</option>
<optionvalue=Navystyle=background-color:navy;color:navy;>Navy</option>
<optionvalue=Maroonstyle=background-color:maroon;color:maroon;>Maroon</option>
<optionvalue=LimeGreenstyle=background-color:limegreen;color:limegreen;>LimeGreen</option>
</select>
</td>
</tr>
<tr>
<td>
<imgsrc=ubb/bold.gifborder=0alt=粗体onClick=ubbFormat(B)><imgsrc=ubb/italicize.gifborder=0alt=斜体onClick=ubbFormat(I)><imgsrc=ubb/underline.gifborder=0alt=下划线onClick=ubbFormat(U)><imgsrc=ubb/center.gifborder=0alt=居中对齐onClick=ubbFormat(CENTER)><imgsrc=ubb/email.gifborder=0alt=插入EMAIL地址onClick=ubbFormat(EMAIL)><imgsrc=ubb/url.gifborder=0alt=插入网址onClick=ubbFormat(URL)><imgsrc=ubb/quote.gifborder=0alt=引用内容onClick=ubbFormat(QUOTE)><imgsrc=ubb/wmv.gifborder=0alt=插入视频onClick=ubbFormat(MEDIA)><imgsrc=ubb/flash.gifborder=0alt=插入flash动画onClick=ubbInsert(FLASH)><imgsrc=ubb/image.gifborder=0alt=插入图片onClick=ubbInsert(IMG)>
</td>
</tr>
<tr>
<td><textareaname=Contentrows=10cols=80></textarea></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</form>
</body>
</html>


评论


亲,登录后才可以留言!