📄 sys_fun.js
字号:
//=============================================================
// 程序名称: ASBLOG
// 程序说明: AllSheng BLOG
// 程序版本: v1.2
// 程序作者: 傲胜工作室(AllSheng Studio)
// 项目主管: Felix Dong
//=============================================================
// 文件名称: Inc/Sys_Fun.js
// 文件作用: JS通用函数
// 更新日期: 2007.04
//=============================================================
// 版权声明: Copyright 2006-2007 AllSheng All Rights Reserved.
// 技术支持: Http://Www.AllSheng.Net/
// 电子邮箱: Support@AllSheng.Net
//=============================================================
//定义程序所在路径,请参考Conn.Asp中"Root"的设置
var Path = "/whwnblog/";
//排列方式函数
//说明:
//ListType_n为类型,1为列表,0为显示简介
//Log_Simple_hidden为隐藏域的Name
function ChangeLogListType(ListType_n) {
var emTemp = document.getElementById('Log_'+ListType_n+'_ListType');
if( emTemp !=null) {
cmChangeElementBold("Log_"+(1-ListType_n)+"_ListType",false);
cmChangeElementBold("Log_"+ListType_n+"_ListType",true);
var arremSimples = document.getElementsByName("Log_Simple_hidden");
var i;
for (i=0;i<arremSimples.length;i++) {
if( ListType_n==0) {
arremSimples[i].parentNode.style.display="";
}else{
arremSimples[i].parentNode.style.display="none";
}
}
}
}
function cmChangeElementBold(strHtmlID,bDesStatus) {
var emDes = document.getElementById(strHtmlID);
if (emDes != null) {
if (bDesStatus==false) {
emDes.style.fontWeight="";
} else {
emDes.style.fontWeight="bold";
}
}
}
//隐藏编辑器工具栏,当点击文本域的时候,自动弹出工具栏
function FCKeditor_OnComplete( editorInstance )
{
editorInstance.Events.AttachEvent( 'OnBlur', FCKeditor_OnBlur ) ;
editorInstance.Events.AttachEvent( 'OnFocus', FCKeditor_OnFocus ) ;
}
function FCKeditor_OnBlur( editorInstance )
{
editorInstance.ToolbarSet.Collapse() ;
}
function FCKeditor_OnFocus( editorInstance )
{
editorInstance.ToolbarSet.Expand() ;
}
//载入评论部分的FCKEditor
function LoadCommentFck() {
var CFCKeditor = new FCKeditor("CommentCon") ;
CFCKeditor.BasePath = Path ;
CFCKeditor.ToolbarSet = "WriteNew" ;
CFCKeditor.Config["SkinPath"] = Path+"Editor/Skins/AllSheng/" ;
CFCKeditor.Width = "500" ;
CFCKeditor.Height = "200" ;
CFCKeditor.Value = "" ;
CFCKeditor.ReplaceTextarea() ;
}
//载入留言部分的FCKEditor
function LoadGBookFck() {
var GFCKeditor = new FCKeditor( "GBookCon" ) ;
GFCKeditor.BasePath = Path ;
GFCKeditor.ToolbarSet = "WriteNew" ;
GFCKeditor.Config["SkinPath"] = Path+"Editor/Skins/AllSheng/" ;
GFCKeditor.Width = "500" ;
GFCKeditor.Height = "200" ;
GFCKeditor.Value = "" ;
GFCKeditor.ReplaceTextarea() ;
}
//检测填写信息是否符合要求
//检测评论部分
function Get(Subject) {return document.getElementById(Subject);}
function CheckWriteComment() {
Get('Submit').disabled=true;
Get('CheckInfo').innerHTML='正在提交数据...';
UserName=Get('UserName')
CommentConLen=Get('CommentConLen')
var oEditor = FCKeditorAPI.GetInstance('CommentCon');
if(UserName.value=='') {
Get('CheckInfo').innerHTML='请填写您的昵称!';
Get('Submit').disabled=false;
return false;
}
//if(UserName.value.length>=20)
//{Get('CheckInfo').innerHTML='用户名不能超过20个字符!';Get('Submit').disabled=true;return false}
if(oEditor.GetXHTML(true)=='') {
Get('CheckInfo').innerHTML='评论内容不能为空!';
Get('Submit').disabled=false;
return false;
}
if(oEditor.GetXHTML(true).length>=CommentConLen.value) {
Get('CheckInfo').innerHTML='评论内容不能超过'+CommentConLen.value+'个字符!';
Get('Submit').disabled=false;
return false;
}
}
//检测留言部分
function CheckWriteGBook() {
Get('Submit').disabled=true;
Get('CheckInfo').innerHTML='正在提交数据...';
UserName=Get('UserName')
Email=Get('Email')
GBookConLen=Get('GBookConLen')
var oEditor = FCKeditorAPI.GetInstance('GBookCon');
if(UserName.value=='') {
Get('CheckInfo').innerHTML='请填写您的昵称!';
Get('Submit').disabled=false;
return false;
}
if((Email.value.length>=1) && ((Email.value.indexOf("@") == -1) || (Email.value.indexOf(".") == -1))) {
Get('CheckInfo').innerHTML='Email格式不正确!';
Get('Submit').disabled=false;
return false;
}
//if(UserName.value.length>=20)
//{Get('CheckInfo').innerHTML='用户名不能超过20个字符!';Get('Submit').disabled=true;return false}
//else
//{Get('CheckInfo').innerHTML='';}
if(oEditor.GetXHTML(true)=='') {
Get('CheckInfo').innerHTML='留言内容不能为空!';
Get('Submit').disabled=false;
return false;
}
if(oEditor.GetXHTML(true).length>=GBookConLen.value) {
Get('CheckInfo').innerHTML='留言内容不能超过'+GBookConLen.value+'个字符!';
Get('Submit').disabled=false;
return false;
}
}
//检测友情链接部分
function CheckNewFriendSite() {
Get('Submit').disabled=true;
Get('CheckInfo').innerHTML='正在提交数据...';
Link_Name=Get('Link_Name')
Link_Url=Get('Link_Url')
if(Link_Name.value=='') {
Get('CheckInfo').innerHTML='请填写网站名称!';
Get('Submit').disabled=false;
return false;
}
if(Link_Url.value=='') {
Get('CheckInfo').innerHTML='请填写网站地址!';
Get('Submit').disabled=false;
return false;
}
}
//检测验证码
function CheckPassCode() {
PassCode=Get('PassCode')
if(PassCode.value=='') {
Get('CheckInfoCode').innerHTML='验证码不能为空!';
return false;
}
else{
Get('CheckInfoCode').innerHTML='';
}
if(PassCode.value.length<4) {
Get('CheckInfoCode').innerHTML='请完整填写验证码!';
return false;
}
else{
Get('CheckInfoCode').innerHTML='';
}
}
//检测搜索部分
function CheckSearchForm() {
Get('SearchSubmit').disabled=true;
Get('CheckSearch').innerHTML='正在搜索...';
Keyword=Get('SearchKeyword')
if(Keyword.value=='') {
Get('CheckSearch').innerHTML='搜索关键字不能为空';
Get('SearchSubmit').disabled=false;
return false;
}
if(Keyword.value.length<3) {
Get('CheckSearch').innerHTML='搜索关键字不能小于3个';
Get('SearchSubmit').disabled=false;
return false;
}
}
//Ajax验证日志密码是否正确
function CheckLogpwd() {
var CheckLogpwdFile = Path+'CheckLogPwd.Asp';
var SendData = 'LogID='+Get('LogID').value+'&LogPwd='+escape(Get('LogPwd').value);
var OpenMethod = "POST";
PublicAjax(CheckLogpwdFile,SendData,"None",OpenMethod);
if("Get('LogPwd').disabled==false;") {
return false;
}
return true;
}
//Ajax显示统计数据
//公用部分
function ShowCountPublic() {
var ShowCountPublicFile = Path+'ShowNew.Asp';
var SendData = 'Action=ShowCount&Flag=Public';
var OpenMethod = "POST";
PublicAjax(ShowCountPublicFile,SendData,"None",OpenMethod);
}
//日志部分
//列表部分,点击数不增加
function ShowCountLogList(LogID) {
var ShowCountLogListFile = Path+'ShowNew.Asp';
var SendData = 'Action=ShowCount&Flag=LogList&LogID='+LogID;
var OpenMethod = "POST";
PublicAjax(ShowCountLogListFile,SendData,"None",OpenMethod);
}
//浏览部分,点击数加1
function ShowCountShowLog(LogID) {
var ShowCountShowLogFile = Path+'ShowNew.Asp';
var SendData = 'Action=ShowCount&Flag=ShowLog&LogID='+LogID;
var OpenMethod = "POST";
PublicAjax(ShowCountShowLogFile,SendData,"None",OpenMethod);
}
//Ajax显示Tags
function ShowAjaxTags() {
var ShowAjaxTagsFile = Path+'ShowTags.Asp';
var SendData = 'Type=AjaxTags';
var OpenMethod = "POST";
PublicAjax(ShowAjaxTagsFile,SendData,"AjaxTags",OpenMethod);
}
//Ajax显示最新评论
function ShowNewCommentList() {
var ShowNewCommentFile = Path+'ShowNew.Asp';
var SendData = 'Action=ShowNewComment';
var OpenMethod = "POST";
PublicAjax(ShowNewCommentFile,SendData,"ShowNewCommentItem",OpenMethod);
}
//Ajax显示最新留言
function ShowNewGBookList() {
var ShowNewGBookFile = Path+'ShowNew.Asp';
var SendData = 'Action=ShowNewGBook';
var OpenMethod = "POST";
PublicAjax(ShowNewGBookFile,SendData,"ShowNewGBookItem",OpenMethod);
}
//显示日志的评论
function ShowLogComment(Flag,LogID,ThePage,DisComment) {
var ShowLogCommentFile = Path+'Comment.Asp';
var SendData = 'action=ShowComment&Flag='+Flag+'&LogID='+LogID+'&Page='+ThePage+'&DisComment='+DisComment;
var OpenMethod = "POST";
PublicAjax(ShowLogCommentFile,SendData,"ShowCommentBlock",OpenMethod);
}
//日历部分
function ShowCalendar(TheYear,TheMonth) {
var ShowCalendarFile = Path+'ShowCalendar.Asp';
var SendData = 'action=Show&TheYear='+TheYear+'&TheMonth='+TheMonth;
var OpenMethod = "POST";
PublicAjax(ShowCalendarFile,SendData,"ShowCalendarBlock",OpenMethod);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -