📄 public.js
字号:
{
NextElement.focus();
}
catch(e1)
{
;
}
if(NextElement.tagName=="INPUT")
{
if(NextElement.type=="text"||NextElement.type=="password")
NextElement.select();
}
}
}
return false;
}
/*****************************************************************
** 函数名: keyUpDown()
** 输 入:
**
**
** 输 出:
**
** 功能描述: 上下键在表单的各个输入项间按顺序跳转
**
** 作 者: rche
** 日 期: 2002-10-28
** 修 改:
** 日 期:
** 版 本:
** 示 例: <FORM onkeypress="keyUpDown() ">
****************************************************************/
function keyUpDown(e)
{
var srcElement=window.event.srcElement;
var iKeyCode=window.event.keyCode;
if(iKeyCode!=40&&iKeyCode!=38) return false;
if(srcElement.tagName=="INPUT"&&(srcElement.type=="button"||srcElement.type=="submit"||srcElement.type=="reset"))
{
return false;
}
if (srcElement.tagName=="INPUT")
{
var i = 0;
while (srcElement!=srcElement.form.elements[i])
{
i++;
if(srcElement.form.elements.length==i) //一直找到最后一个元素
return false;
}
//继续循环找到非Disabled和readOnly
var NextElement=srcElement.form.elements[i+1];
var DelTa=(iKeyCode==40)?1:-1;
for(j=i+DelTa;(DelTa==1)?(j<srcElement.form.elements.length):(j>=0);j=j+DelTa)
{
NextElement=srcElement.form.elements[j];
if(NextElement.readOnly||(NextElement.disabled==true||NextElement.disabled=='disabled')||NextElement.style.display=="none")
{
NextElement=null;
continue;
}
if(NextElement.tagName=="INPUT")
{
if(NextElement.type=="hidden")
{
NextElement=null;
continue;
}
}
break;
}
if(NextElement)
{
if(srcElement.tagName=="INPUT"&&srcElement.type=="file")
;
else
window.event.keyCode=0;
try
{
NextElement.focus();
}
catch(e2)
{
;
}
if(NextElement.tagName=="INPUT")
{
if(NextElement.type=="text"||NextElement.type=="password")
NextElement.select();
}
}
}
return false;
}
/*****************************************************************
** 函数名: GetNameAtOnce(TName,ToChangeName,FieldName)
** 输 入: TName--表名称,ToChangeName--名称反填何处(可以不传,不传为发生事件的输入框)
** FieldCode--代码字段
**
** 输 出: 代码名称(ToChangeName传了值),否则:代码名称+'('+代码+')'
**
** 功能描述: 立即取得输入项代码的名称
**
** 作 者: rche
** 日 期: 2002-10-28
** 修 改:
** 日 期:
** 版 本:
** 示 例:
****************************************************************/
function GetNameAtOnce(TName,ToChangeName,FieldName,FieldCode)
{
if(!ToChangeName)
{
if(window.event.srcElement.value)
window.event.srcElement.value=GetNameByCode(TName,window.event.srcElement.value,true,FieldName,FieldCode);
}
else
{
if(window.event.srcElement.form&&window.event.srcElement.form[ToChangeName])
window.event.srcElement.form[ToChangeName].value=GetNameByCode(TName,window.event.srcElement.value,false,FieldName,FieldCode);
else
{
if(!window.event.srcElement.form)
alert("GetNameAtonce 表单输入项上");
else
alert("ToChangeName 参数错误");
}
}
}
/*****************************************************************
** 函数名: GetNameByCode(TName,CodeValue,WithCode,FieldName,FieldCode)
** 输 入: TName--表名称
** CodeValue--代码值WithCode--返回值是否带代码返回
** WithCode--返回值是否带代码返回
** FieldName--名称字段
** FieldCode--代码字段
** 输 出: 代码名称(WithCode=false),否则:代码名称+'('+代码+')'
**
** 功能描述: 取得代码的名称(使用xml技术,界面不刷新)
**
** 作 者: rche
** 日 期: 2002-10-28
** 修 改:
** 日 期:
** 版 本:
** 示 例:
****************************************************************/
//表名
// string TName=Request.QueryString["TName"];
//代码值
//string strValue=Request.QueryString["CodeValue"];
//代码字段
//string CodeField=Request.QueryString ["CodeField"];
//名称字段
//string NameField=Request.QueryString ["NameField"];
function GetNameByCode(TName,CodeValue,WithCode,FieldName,FieldCode)
{
var i;
i=window.location.toString().lastIndexOf('/');
var url=''
if(i>=0)
{
url=window.location.toString().substring(0,i);
//alert (url);
}
var oXMLDoc = new ActiveXObject('MSXML');
//alert("dhghsdg");
oXMLDoc.url = "../Parameter/" + "CreateCodeXML.aspx?TName="+TName+"&CodeValue=" + CodeValue+"&CodeField="+FieldCode+"&NameField="+FieldName;
var oRoot=oXMLDoc.root;
if(oRoot.children!= null)
{
var oItem=oRoot.children.item(0);
if(oItem.GetAttribute("Name")!='')
{
window.status="";
if(!WithCode)
return oItem.GetAttribute("Name");
else
return oItem.GetAttribute("Name")+"("+oItem.GetAttribute("Code")+")";
}
else
{
if(!WithCode)
{
if(FieldName)
window.status="代码输入不正确";
else
window.status="";
return "";
}
else
{
if(FieldName)
window.status="代码输入不正确";
else
window.status="";
return CodeValue;
}
}
}
}
/*------------------------------------------------------------------------------------
功能描述:取得字符串中代码部分,字符串的格式:名称+'('+代码+')'
创建时间:2002-?
修改时间:2002-06-11
参数描述:value--字符串
返回值:字符串的字节长度
创建人:rche
------------------------------------------------------------------------------------*/
function GetCode(Value)
{
var begin_pos,end_pos;
begin_pos=Value.lastIndexOf('(');
end_pos=Value.length-1;
if(end_pos==-1||Value.charAt(end_pos)!=')')
end_pos=-1;
if(end_pos<begin_pos+2)
{
if(!isNaN(Value))
return Value;
else
return "";
}
else
return Value.substr(begin_pos+1,end_pos-begin_pos-1);
}
/*------------------------------------------------------------------------------------
功能描述:全选取CheckBox的方法
创建时间:2003-04-16
修改时间:
参数描述:obj--全选的checkbox对象,如document.all.checkbox1
返回值:无
创建人:rche
------------------------------------------------------------------------------------*/
function funSelectAll(obj)
{
var aReturn = document.getElementsByTagName("input")
for (i=0;i<aReturn.length;i++)
{
if(aReturn[i].type == "checkbox")
{
aReturn[i].checked = obj.checked ;
}
}
}
/*****************************************************************
** 函数名: 用于页面中的 显示查询、隐藏查询 间的切换
*****************************************************************/
function QueryOnChang()//切换查询条件的
{
//
if(document.all["pnlSearch"].style.display=="none")
{
document.all["pnlSearch"].style.display='';
event.srcElement.innerText="隐藏查询";
document.all["QueryImg"].src="../Images/move_up.gif";
}
else
{
document.all["pnlSearch"].style.display='none';
event.srcElement.innerText="显示查询";
document.all["QueryImg"].src="../Images/move_down.gif";
}
}
/*******************************************************************
** 随着鼠标位置显示的可以随意切换的层
********************************************************************/
var bV=parseInt(navigator.appVersion);
var NN4=(document.layers) ? true : false;
var IE4=((document.all)&&(bV>=4))?true:false;
var moveFlag=false;
var fntSize=9; // 訊息框內的字型大小
var tipBgColor="EDEDED"; // 訊息框的底色
var tipBorderColor="1590DD"; // 訊息框的邊框顏色
var tipTextColor="000000"; // 訊息框內文字的顏色
function setReload(){
window.location.reload()
}
function showTip(msg){
msg = "<table cellSpacing=3 cellPadding=0 align=center border=0 width=400><tr align=center><td>" + msg + "</td></tr></table>";
var obj = 'TipBox';
moveFlag=true;
if(NN4){
with (document[obj].document){
open();
write('<layer ID=TipBox bgColor=#'+tipBgColor+' style="border:1px solid #'+tipBorderColor+'; font-size:'+fntSize+'pt;"><font color=#'+tipTextColor+' lang="GB3210" face="宋体">'+msg+'</font></layer>');
close();
}
document.layers[obj].visibility = 'visible';
}else if(IE4){
IE_MouseMove();
document.all[obj].innerHTML = msg;
document.all[obj].style.visibility = 'visible';
}
}
function hideTip(){
var obj = 'TipBox';
moveFlag=false;
if(NN4){
if(document.layers[obj] != null) document.layers[obj].visibility = 'hidden';
}else if(IE4)
document.all[obj].style.visibility = 'hidden';
}
function IE_MouseMove(){
if(moveFlag){
var x = event.x; // 取得滑鼠指標目前的 x 位置
var y = event.y; // 取得滑鼠指標目前的 y 位置
var objp = document.all.TipBox.style;
var xx = (document.body.scrollLeft+x);
var yy = (document.body.scrollTop+y);
objp.pixelLeft = xx+20;
objp.pixelTop = yy;
}
}
function NN_MouseMove(e){
if(moveFlag){
var objp = document.layers.TipBox;
objp.moveTo(e.x+20, e.y);
}
}
if(IE4){
document.write("<DIV ID=TipBox STYLE='position:absolute; visibility: hidden; padding: 0.2em 0.2em 0.2em 0.2em; color: #"+tipTextColor+"; background-color: #"+tipBgColor+"; border:1px solid #"+tipBorderColor+";z-index:2; font-size: "+fntSize+"pt'></DIV>");
document.onmousemove = IE_MouseMove;
}else{
document.write("<DIV ID=TipBox STYLE='position:absolute; visibility: hidden; background-color: #"+tipBgColor+"; border:1px solid #"+tipBorderColor+";z-index:2; font-size: "+fntSize+"pt'></DIV>");
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = NN_MouseMove;
setTimeout("window.onresize=setReload",500)
}
/****************************************************************************************
*****************************************************************************************/
var isIE4 = false
var isNav4 = false
var isNav6 = false
function setBrowser()
{
//Simple browser sniffer
if (document.all)
{
isIE4 = true
}
else if (document.layers)
{
isNav4 = true
}
else if (document.getElementById)
{
isNav6 = true //also true for IE5.5
}
}
function toggleElementDisplay( element, strStyle )
{
// strStyle = (none,block,inline)
setBrowser();
var strID
//get the element id
if (typeof element == "object")
{
strID = element.id
}
else if (typeof element == "string")
{
strID = element
}
if ((strID != "") && (strID != null))
{
if (isIE4 || isNav6)
{
if ( getStylePropertyById( strID,'display')=='none' )
{
setStylePropertyById( strID, 'display', strStyle ) //show the element
}
else
{
setStylePropertyById( strID, 'display', 'none' ) //hide the element
}
}
}
}
function toggleImg( element, strImg1, strImg2 )
{
var oElement;
var strImg1New = "";
var srtImg2New = "";
oElement = getElementObject( element );
strImg1New = strImg1.replace("../","");
//alert(strImg1New );
if (oElement != null)
{
var strSrc = oElement.src;
if ( strSrc.indexOf(strImg1New) > -1 )
{
oElement.src = strImg2;
}
else
{
oElement.src = strImg1;
}
}
}
function setStylePropertyById( strId, strProperty, strValue )
{
if (isNav6)
{
var styleObject = document.getElementById( strId );
if (styleObject != null)
{
styleObject = styleObject.style;
styleObject[ strProperty ] = strValue;
}
}
else if (isIE4)
{
if (document.all[strId] != null)
document.all[strId].style[strProperty] = strValue;
}
else
{} //so Nav4 won't return error
}
function getElementObject( element )
{
var oElement = null;
// get the element
if (typeof element == "object")
{
oElement = element;
}
else if (typeof element == "string")
{
oElement = getElementById( element );
}
return oElement;
}
function getElementById( strId )
{
if (isNav6)
{
return document.getElementById( strId );
}
else if (isIE4)
{
return document.all[strId]
}
else
{
return null
}
}
function getStylePropertyById( strId, strProperty )
{
if (isNav6)
{
var styleObject = document.getElementById( strId );
if (styleObject != null)
{
styleObject = styleObject.style;
if (styleObject[strProperty])
{
return styleObject[ strProperty ];
}
}
styleObject = getStyleBySelector( "#" + strId );
return (styleObject != null) ?
styleObject[strProperty] :
null;
}
else if (isIE4)
{
return document.all[strId].style[strProperty];
}
else
{
return ""
}
}
function getStyleBySelector( selector )
{
if (!isNav6)
{
return null;
}
var sheetList = document.styleSheets;
var ruleList;
var i, j;
/* look through stylesheets in reverse order that
they appear in the document */
for (i=sheetList.length-1; i >= 0; i--)
{
ruleList = sheetList[i].cssRules;
for (j=0; j<ruleList.length; j++)
{
if (ruleList[j].type == CSSRule.STYLE_RULE && ruleList[j].selectorText == selector)
{
return ruleList[j].style;
}
}
}
return null;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -