【编者按】网学网ASP频道为大家收集整理了“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.