当前位置: 首页 > 图文教程 > 网络编程 > ASP > UBB编辑器

ASP
ASP正则表达式技巧
ASP Access实现网站计数器(访问量)
ASP新闻分页,将一篇过长的文章分页,生成静态页面
一些关于asp 购物车的想法
一个sql查询器,自动画表格填字段
ASP实现文件直接下载的代码
把网页中的(电话,qq等数字)生成图片的ASP程序
asp长文章用分页符来分页显示
Asp函数介紹(37个常用函数)
ASP中的面向对象类
分页实现方法的性能比较
asp ajax跨域提交数据
asp修改文件和文件夹的名字的代码
ASP 多关键词查询实例代码
asp被杀毒软件误删的解决方法
asp 多关键词搜索的简单实现方法
asp 根据IP地址自动判断转向分站的代码
asp dictionary对象的用法
ASP 千万级数据分页的存储过程
ASP隐藏真实文件的下载功能实现代码

ASP 中的 UBB编辑器


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 58 ::
收藏到网摘: n/a

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "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="/upload/tech/20091012/20091012011646_f770b62bc8f42a0b66751fe636fc6eb0.gif" border="0" alt="粗体" onClick="ubbFormat('B')"><img src="/upload/tech/20091012/20091012011646_142949df56ea8ae0be8b5306971900a4.gif" border="0" alt="斜体" onClick="ubbFormat('I')"><img src="/upload/tech/20091012/20091012011647_357a6fdf7642bf815a88822c447d9dc4.gif" border="0" alt="下划线" onClick="ubbFormat('U')"><img src="/upload/tech/20091012/20091012011647_e555ebe0ce426f7f9b2bef0706315e0c.gif" border="0" alt="居中对齐" onClick="ubbFormat('CENTER')"><img src="/upload/tech/20091012/20091012011648_beb22fb694d513edcf5533cf006dfeae.gif" border="0" alt="插入EMAIL地址" onClick="ubbFormat('EMAIL')"><img src="/upload/tech/20091012/20091012011648_757b505cfd34c64c85ca5b5690ee5293.gif" border="0" alt="插入网址" onClick="ubbFormat('URL')"><img src="/upload/tech/20091012/20091012011649_37f0e884fbad9667e38940169d0a3c95.gif" border="0" alt="引用内容" onClick="ubbFormat('QUOTE')"><img src="/upload/tech/20091012/20091012011649_6081594975a764c8e3a691fa2b3a321d.gif" border="0" alt="插入视频" onClick="ubbFormat('MEDIA')"><img src="/upload/tech/20091012/20091012011649_2dea61eed4bceec564a00115c4d21334.gif" border="0" alt="插入flash动画" onClick="ubbInsert('FLASH')"><img src="/upload/tech/20091012/20091012011650_3def184ad8f4755ff269862ea77393dd.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>