?? index.js
字號(hào):
// JavaScript Document
//為String 對(duì)象添加trim()方法
String.prototype.trim=function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
//檢查表單
function checkPost()
{
if(document.post.content.value.trim().length==0)
{
alert("帖子正文不能為空!\n請(qǐng)?zhí)顚懲耆?.....");
document.post.content.focus();
return false;
}
if(document.post.content.value.length>600)
{
alert("您的帖子正文字節(jié)數(shù)為"+document.post.content.value.length+"\n正文長度請(qǐng)控制在600字節(jié)以下");
document.post.content.focus();
return false;
}
return true;
}
//檢查編輯區(qū)域范圍內(nèi)有多少字節(jié)
function checkLength()
{
alert("您的文章目前共有 "+document.post.content.value.length+" 字節(jié)");
}
//UBB自動(dòng)添加函數(shù)
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("輸入要左對(duì)齊的文字","文字");
if(post!=null)
{
document.post.content.value=document.post.content.value+"[left]"+post+"[/left]";
}
}
function addRight()
{
var post=prompt("輸入要右對(duì)齊的文字","文字");
if(post!=null)
{
document.post.content.value=document.post.content.value+"[right]"+post+"[/right]";
}
}
function addimages()
{
var post=prompt("請(qǐng)輸入完整的圖片鏈接地址\n比如http://www.systra.com.cn/logo.gif","完整的地址");
if(post!=null)
{
document.post.content.value=document.post.content.value+"[img]"+post+"[/img]";
}
}
function addURL()
{
var post=prompt("請(qǐng)輸入完整的地址\n比如http://www.systra.com.cn","完整的地址");
if(post!=null)
{
document.post.content.value=document.post.content.value+"[url]"+post+"[/url]";
}
}
function addEmail()
{
var post=prompt("請(qǐng)輸入完整的郵件地址\n比如wangsheng@systra.com.cn","完整的地址");
if(post!=null)
{
document.post.content.value=document.post.content.value+"[email]"+post+"[/email]";
}
}
function addQuote()
{
var post=prompt("請(qǐng)輸入引用的文字","文字");
if(post!=null)
{
document.post.content.value=document.post.content.value+"[quote]"+post+"[/quote]";
}
}
function setFont(font)
{
var post=prompt("請(qǐng)輸入想改變字體的文字","文字");
if(post!=null)
{
document.post.content.value=document.post.content.value+"[font="+font+"]"+post+"[/font]";
}
}
function setSize(size)
{
var post=prompt("請(qǐng)輸入想改變大小的文字","文字");
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;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -