?? index.js
字號:
// JavaScript Document
//為String 對象添加trim()方法
String.prototype.trim=function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
//檢查表單
function checkPost()
{
if(document.post.content.value.trim().length==0)
{
alert("帖子正文不能為空!\n請填寫完全......");
document.post.content.focus();
return false;
}
if(document.post.content.value.length>600)
{
alert("您的帖子正文字節數為"+document.post.content.value.length+"\n正文長度請控制在600字節以下");
document.post.content.focus();
return false;
}
return true;
}
//檢查編輯區域范圍內有多少字節
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.jzhzg.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.jzhzg.com","完整的地址");
if(post!=null)
{
document.post.content.value=document.post.content.value+"[url]"+post+"[/url]";
}
}
function addEmail()
{
var post=prompt("請輸入完整的郵件地址\n比如hack520vip@21cn.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;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -