📄 global.js
字号:
var $ = function ( id )
{
if( document.getElementById )
{
return document.getElementById(id);
}else
{
return null;
}
}
function Point(iX, iY)
{
this.x = iX;
this.y = iY;
}
function class_datalist()
{
var temp = new Array();
this.Append = function ( key, value )
{
temp[key] = value;
}
this.Remove = function ( key )
{
temp.splice(key,1);
}
this.get = function ( key )
{
return temp[key];
}
this.Clear = function ()
{
temp = new Array();
}
this.data = temp;
this.length = temp.length;
this.size = function () { return this.length; }
}
function class_DMFx()
{
//=== Private variable
var formElements = new class_datalist;
var formElementTips = new class_datalist;
var formValidated = false;
//=== Public Progerty
this.ID = null;
//=== Public Method
this.pageInit = function ( objID )
{
try
{
var tempObj = getObject(objID);
if(!tempObj)
{
return false;
}
cacheForm(tempObj);
tempObj.elements[0].focus();
}
catch(e)
{
return false;
}
}
this.getControlValue = function ( ControlID )
{
if ( document.getElementById(ControlID) )
{
return document.getElementById(ControlID).value;
}
return "";
}
this.getControlChecked = function ( ControlID )
{
if ( document.getElementById(ControlID) )
{
return document.getElementById(ControlID).checked;
}
return false;
}
this.getControlSelected = function ( ControlID )
{
if ( document.getElementById(ControlID) )
{
return document.getElementById(ControlID).selected;
}
return false;
}
this.removeSelectForList = function ( ControlID )
{
var obj = document.getElementById(ControlID);
if ( !obj ) return;
var opts = obj.options;
for ( var i = 0 ; i < opts.length ; i ++ )
{
if ( opts[i].selected )
{
obj.removeChild(opts[i]);
i -= 1;
}
}
}
this.SelectAllForList = function ( ControlID )
{
var obj = document.getElementById(ControlID);
if ( !obj ) return;
var s = (obj.value=='');
var opts = obj.options;
for ( var i = 0 ; i < opts.length ; i ++ )
{
opts[i].selected = s;
}
}
this.FixZero = function ( intValue )
{
var strValue = new String(intValue);
if ( strValue.length < 2 ) return "0" + strValue;
return strValue;
}
this.getXY = function( aTag )
{
var oTmp = aTag;
var pt = new Point(0,0);
do
{
pt.x += oTmp.offsetLeft;
pt.y += oTmp.offsetTop;
oTmp = oTmp.offsetParent;
} while(oTmp.tagName!="BODY");
return pt;
}
this.Show = function ( objID )
{
var t = document.getElementById(objID);
if ( t != null )
{
t.style.display = t.style.display != "block"?"block":"none";
}
}
this.ShowOnly = function ( objID )
{
var t = document.getElementById(objID);
if ( t != null )
{
t.style.display = "block";
}
}
this.HiddenOnly = function ( objID )
{
var t = document.getElementById(objID);
if ( t != null )
{
t.style.display = "none";
}
}
this.BoxShow = function (URI)
{
var t = window.open(URI,"","WIDTH=500,HEIGHT=400,Scrollbars=yes");
}
this.SmallBoxShow = function (URI)
{
var t = window.open(URI,"","WIDTH=200,HEIGHT=250");
}
this.fromStandy = function ()
{
return formValidated;
}
this.isEnterAndCtrlKey = function ()
{
var ie=(document.all)?true:false;
if(ie)
{
return ( window.event.ctrlKey && window.event.keyCode == 13 );
}
else
{
return false;
}
}
this.isAltAndSKey = function ()
{
var ie = (document.all)?true:false;
if ( ie )
{
return ( window.event.altKey && window.event.keyCode == 83 );
}else
{
return false;
}
}
this.SelectALL = function ( obj,target )
{
var t = document.getElementsByName(target);
for ( var i = 0;i < t.length;i ++ )
{
t[i].checked = obj.checked?true:false;
}
}
this.disposeSendProcess = function ()
{
if ( window.opener != null )
{
window.close();
}else
{
history.go(-1);
}
}
this.sendData = function ( formID,isNeedValidate )
{
var _isNeedValidate = isNeedValidate;
if ( _isNeedValidate == null ) _isNeedValidate = false;
if ( (!formValidated) && _isNeedValidate )
{
if(this.validateUserAccount() && this.validateUserPassword() && this.validateUserRePassword() && this.validateUserName() )
{
//...
}else
{
return;
}
}else
{
formValidated = true;
}
var tempObj = getObject(formID);
if(!tempObj)
{
return false;
}
validateForm(tempObj);
try
{
tempObj.submit();
return true;
}
catch(e)
{
return false;
}
}
this.setFontSize = function ( obj,size )
{
if( $(obj) )
{
$(obj).style.fontSize = size + "pt";
}
}
this.canelChange = function ( formID )
{
var tempObj = getObject(formID);
if (!tempObj) return false;
tempObj.reset();
return true;
}
this.reloadImg = function ( objid )
{
var obj = document.getElementById(objid);
if ( obj != null ) obj.src = "./Validate.aspx?a=" + (new Date()).getTime();
}
this.reloadSubDirImg = function ( objid )
{
var obj = document.getElementById(objid);
if ( obj != null ) obj.src = "../Validate.aspx?a=" + (new Date()).getTime();
}
this.ShowInfo = function ( obj )
{
var o = document.getElementById(obj);
if ( o != null ) o.style.display = "block";
}
this.HiddenInfo = function ( obj )
{
var o = document.getElementById(obj);
if ( o != null ) o.style.display = "none";
}
this.gotoIndex = function ()
{
location.replace("./");
}
this.gotoPersonIndex = function ()
{
location.replace("Setting.aspx");
}
this.getPassword = function ()
{
location.replace("getPassword.aspx");
}
this.gotoRegister = function ()
{
location.replace("Register.aspx");
}
this.drawPanel = function ( objID )
{
var tempObj = getObject("message_" + objID);
tempObj.className = "message";
var tempObj = getMessageObject(objID);
tempObj.style.display = "block";
this.ID = objID;
}
this.clearPanel = function ( objID )
{
var tempObj = getObject("message_" + objID);
tempObj.className = "message-null";
var tempObj = getMessageObject(objID);
tempObj.style.display = "none";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -