⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.js

📁 不错的留言本 主要功能:   ·支持UBB;   ·屏蔽HTML;   ·加入表情;   ·发言
💻 JS
字号:
// JavaScript Document
//为String 对象添加trim()方法
String.prototype.trim=function()
{
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

//检查编辑区域范围内有多少字节
function checkLength()
{
	alert("您的文章目前共有 "+document.post.content.value.length+" 字节");
}
//UBB自动添加函数
function addBold()
{
	var post=prompt("输入要加粗的文字","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[b]"+post+"[/b]";
	}
}
function addEm()
{
	var post=prompt("输入要倾斜的文字","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[i]"+post+"[/i]";
	}
}
function addCenter()
{
	var post=prompt("输入要居中显示的文字","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[center]"+post+"[/center]";
	}
}
function addLeft()
{
	var post=prompt("输入要左对齐的文字","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[left]"+post+"[/left]";
	}
}
function addRight()
{
	var post=prompt("输入要右对齐的文字","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[right]"+post+"[/right]";
	}
}
function addimages()
{
	var post=prompt("请输入完整的图片链接地址\n比如http://www.jspsky.com/logo.gif","完整的地址");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[img]"+post+"[/img]";
	}
}
function addURL()
{
	var post=prompt("请输入完整的地址\n比如http://www.jspsky.com","完整的地址");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[url]"+post+"[/url]";
	}
}
function addEmail()
{
	var post=prompt("请输入完整的邮件地址\n比如:jspsky@jspsky.com","完整的地址");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[email]"+post+"[/email]";
	}
}
function addQuote()
{
	var post=prompt("请输入引用的文字","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[quote]"+post+"[/quote]";
	}
}
function setFont(font)
{
	var post=prompt("请输入想改变字体的文字","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[font="+font+"]"+post+"[/font]";
	}
}
function setSize(size)
{
	var post=prompt("请输入想改变大小的文字","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"[size="+size+"]"+post+"[/size]";
	}
}
function setColor(color)
{
	var post=prompt("文字染色","文字");
	if(post!=null)
	{
		document.post.content.value=document.post.content.value+"["+color+"]"+post+"[/"+color+"]";
	}
}
function addMood(mood)
{
	document.post.content.value=document.post.content.value+mood;
}
function CurObjTime(CurrentDateStr)
{
	var CurObjTime,YY,MM,DD,CurrentDateStr;
	CurObjTime = new Date();
	YY = CurObjTime.getFullYear ();
	MM = CurObjTime.getMonth () + 1;
	DD = CurObjTime.getDate ();
	CurrentDateStr = YY + "年" + MM + "月" + DD + "日";
	document.post.content.value=document.post.content.value+CurrentDateStr;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -