?? comm_func.js
字號:
var EndFlag = 1;
function MM_findObj(n,d)
{
var p,i,x;
if(!d)d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById)x=document.getElementById(n);return(x);
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MSHL()
{
var i,p,v,obj,args=MSHL.arguments;
for(i=0;i<(args.length-2);i+=3)if((obj=MM_findObj(args[i]))!=null){v=args[i+2];
if(obj.style){obj=obj.style;v=(v=='show')?'visible':(v='hide')?'hidden':v;}
obj.visibility=v;}
}
// 問候語提示
function ShowHello() {
var welcomestring;
var d = new Date();
h = d.getHours();
if(h<6)
welcomestring="凌晨好";
else if (h<9)
welcomestring="早上好";
else if (h<12)
welcomestring="上午好";
else if (h<14)
welcomestring="中午好";
else if (h<17)
else if (h<19)
welcomestring="傍晚好";
else if (h<22)
welcomestring="晚上好";
else
welcomestring="夜里好";
document.write(welcomestring);
}
/*function CheckFormLogin()
{
if (document.frmLogin.iptUserName.value == "" )
{
alert(':-) 對不起!請您填入用戶名。');
document.frmLogin.iptUserName.focus()
return false;
}
if (document.frmLogin.iptPassword.value == "" )
{
alert(':-) 對不起!請您填入用戶密碼。');
document.frmLogin.iptPassword.focus()
return false;
}
if (document.frmLogin.iptPassword.value.length < 5 )
{
alert(':-) 對不起!,您輸?shù)拿艽a小于6位。密碼應(yīng)為6-14位');
document.frmLogin.iptPassword.focus()
return false;
}
return true;
}
*/
// 自適應(yīng)顯示圖片
function DrawImage(ImgD,intLargeImgWidth,intLargeImgHeight,intAltFlag)
{
var image = new Image();
image.src = ImgD.src;
if (image.width > 0 && image.height > 0)
{
flag = true;
if (image.width/image.height >= intLargeImgWidth/intLargeImgHeight)
{
if (image.width > intLargeImgWidth)
{
ImgD.width = intLargeImgWidth;
ImgD.height = (image.height * intLargeImgWidth)/image.width;
}
else
{
ImgD.width = image.width;
ImgD.height = image.height;
}
if (intAlfFlag = 0 )
{
ImgD.alt = "實際大小:" + image.width + "×" + image.height + ",點擊查看原始圖";
}
}
else
{
if (image.height > intLargeImgHeight)
{
ImgD.height = intLargeImgHeight;
ImgD.width = (image.width * intLargeImgHeight)/image.height;
}
else
{
ImgD.width = image.width;
ImgD.height = image.height;
}
if (intAltFlag = 0 )
{
ImgD.alt = "實際大小:" + image.width + "×" + image.height+ ",點擊查看原始圖";
}
}
}
/*else{
ImgD.src="";
ImgD.alt=""
}*/
}
// 自適應(yīng)顯示圖片
function DrawImage2(ImgD,intLargeImgWidth)
{
var image = new Image();
image.src = ImgD.src;
if (image.width > intLargeImgWidth)
{
ImgD.width = intLargeImgWidth;
}
ImgD.alt = "實際大小:" + image.width + "×" + image.height + ",點擊查看原始圖";
}
function CheckFormLogin()
{
if (document.frmLogin.iptUserName.value.length < 2 || document.frmLogin.iptUserName.value.length > 10 )
{
alert(':-) 對不起!請您填入用戶名(2-10字)');
document.frmLogin.iptUserName.focus();
return false;
}
if (document.frmLogin.iptPassword.value.length < 6 || document.frmLogin.iptPassword.value.length > 20 )
{
alert(':-) 對不起!請您填入用戶密碼(6-20字)');
document.frmLogin.iptPassword.focus();
return false;
}
return true;
}
function CheckGoForm()
{
if (!IsNumeric(document.frmGo.intPageNow.value))
{
alert(':-) 對不起!請您填入正確的頁碼');
document.frmGo.intPageNow.focus();
return false;
}
return true;
}
function IsNumeric(p)
{
if (p == "")
return false;
var l = p.length;
var count = 0;
for (var i = 0; i < l; i++)
{
var digit = p.charAt(i);
if (digit == "." )
{
++count;
if (count > 1) return false;
}
else if (digit < "0" || digit > "9")
return false;
}
return true;
}
//表單提交后submit按鈕變?yōu)椴豢捎?function submitonce(theform)
{
if (document.all||document.getElementById)
{
for (i=0;i<theform.length;i++)
{
var tempobj=theform.elements[i];
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
tempobj.disabled=true;
}
}
}
//改變背景顏色
function BgChange(field,strClassName)
{
field.className = strClassName;
}
//加為收藏 0--好友 1--帖子 2--相片
function OpwCollection(r,id,name)
{
window.open('../dialog/dialog_collection_form.asp?iptType=' + r + "&OID=" + id + "&iptName=" + name,'','width=450,height=37,scrollbars=auto,status=no');
}
//設(shè)定留言板的心情圖標(biāo)
function SetSmileFace()
{
window.open('board_smile_face.asp','','width=250,height=450,scrollbars=auto,status=yes');
}
//改變留言板的心情圖標(biāo)
function ChangeSmileFace()
{
var strTemp;
ValidationPassed = true;
strTemp = document.frmAddBoard.iptSmileFace.value;
document.imgSmileFace.src = './smileface/' + strTemp + '.gif';
return ValidationPassed
}
//設(shè)定用戶卡通圖標(biāo)
function SetCartoonFace()
{
window.open('user_cartoon_face.asp','','width=500,height=450 scrollbars=auto,status=yes');
}
//全選動作
function CheckAll(form,object)
{
for(var i = 0 ; i < form.elements.length ; i++)
{
var E = form.elements[i];
if((E.name != object.name) && (E.type == "checkbox"))
{
E.checked = object.checked;
}
}
}
//翻頁
function PageTurn(url,value)
{
window.location.href=url + "intPageNow=" + value;
}
//校驗是否選擇checkbox
function CheckSelChkBox(form,hint)
{
var reflag;
reflag = confirm(hint);
if (!reflag) return false;
var b = 0;
for(a = 0;a < form.elements.length;a++)
{
if(form.elements[a].checked == true)
{
b = 1;
}
}
if(!b)
{
alert("對不起,你未選擇任何操作項!");
return false;
}
form.submit();
}
function fPopUpCalendarDlg(ctrlobj)
{
showx = event.screenX - event.offsetX - 4 - 10 ; // + deltaX;
showy = event.screenY - event.offsetY -168; // + deltaY;
newWINwidth = 210 + 4 + 18;
retval = window.showModalDialog("../inc/inc_calendar.asp", "", "dialogWidth:170px; dialogHeight:190px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; " );
if( retval != null ){
ctrlobj.value = retval;
}else{
//alert("canceled");
}
}
//ubb tag
document.write('<script language="JavaScript" src="../js/ubbcode.js"><\/script>');
document.write('<script language="JavaScript" src="../js/forum_func.js"><\/script>');
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -