📄 function.js
字号:
//------------------------------------------------------------------------------
// 爱喜软件 IBSGov V5.0 客户端接口函数库
// 设计:江龙 (Dragon_jiang@163.net)
// 2002-5 至 2002-8
// 版权所有 引用须注
// 广州市爱喜软件有限公司
//------------------------------------------------------------------------------
var nullPhoto="/images/System/No.gif"; //空图片文件名
var curID=null; //当前的层
var curNo=1; //当前选择的层号
var True=true;
var False=false;
var isInit=false; //页面是否初始化完成
function Select(n)
{
if(curID==null) curID=divID1;
curID.style.display='none';
curID=eval("divID" + n);
curNo=n;
curID.style.display='';
return(false);
}
function getRadioValue(Name)
{
var e=document.getElementsByName(Name)
for(var i=0;i<e.length;i++)
{
if(e[i].checked) return(e[i].value);
}
return("");
}
function setRadioValue(Name,value)
{
var e=document.getElementsByName(Name)
for(var i=0;i<e.length;i++)
e[i].checked=(e[i].value==value);
}
function showToday()
{
var today = new Date();
var centry ;
var s=new Array("日","一","二","三","四","五","六");
centry="";
if(today.getYear()<2000 ) centry = "19" ;
var date1 = centry + (today.getYear()) + "年" + (today.getMonth() + 1 ) + "月";
document.write('<table height=102 cellSpacing=0 cellPadding=0 width=120 background=/Images/OA/Home/diary.gif border=0>'+
'<tbody><tr><td><table height=102 cellSpacing=0 cellPadding=0 width=120 background=/Images/OA/Home/diary.gif border=0>'+
'<tbody><tr><td><table height=72 cellSpacing=0 cellPadding=0 width=120 border=0><tbody>'+
'<tr><td height=23 align=center>' +date1+ '</td></tr>'+
'<tr><td height=24 align=center><font color=#ff0000 face="Arial Black" style="font-size:12pt">' +today.getDate()+ '</font></td></tr>'+
'<tr><td height=23 align=center>星 期 '+s[today.getDay()]+ '</td></tr>'+
'</tbody></table></td></tr></tbody></table></td></tr></tbody></table>');
}
function showDialog(Title,URL,t,Status)
{
if(window.showModalDialog("/Lib/showDialog.htm?Title="+escape(trim(Title))+"&URL="+escape(trim(URL)),this,Status+';resizable=no;status=no'))
this.location.reload();
return(false);
}
function editUser(UID)
{if (trim(UID)=="")
alert("用户ID号错误!");
else
switch(UID.charAt(0))
{
case "E":
return(editEmployee(UID));
break;
case "S":
return(editStudent(UID));
break;
case "M":
return(editMinistry(UID));
break;
case "P":
return(editPaterfamilias(UID));
break;
default:
alert("非本校合法用户不能查看其信息!");
}
}
function previewKQ(LeaveID)
{
showDialog("请假申请",'/School/KaoQin/Leave/Edit.asp?LeaveID='+LeaveID,'',"dialogTop=20px;dialogWidth=570px;dialogHeight=453px;");
return(false)
}
function editAccount(UserID)
{ if (trim(UserID)=="")
alert("用户ID号错误!");
else
switch(UserID.charAt(0))
{
case "G":
showDialog("部门用户设置","/OA/UserRole/Employee/Edit.asp?UserID="+UserID,"","dialogWidth=620px;dialogHeight=430px;dialogTop=50px");
break;
case "S":
showDialog("学生用户账号设置","/School/System/Student/Edit.asp?UserID="+UserID,"","dialogWidth=620px;dialogHeight=430px;dialogTop=50px");
break;
case "M":
window.open("/School/System/Ministry/Edit.asp?UserID="+UserID,"_blank","left=100,width=600,height=400,top=20,scrollbars=no,resize=no");
break;
case "P":
showDialog("家长用户账号设置","/School/System/Paterfamilias/Edit.asp?UserID="+UserID,"","dialogWidth=620px;dialogHeight=430px;dialogTop=50px");
break;
default:
alert("非本校合法用户不能查看其信息!");
}
return(false);
}
function editEmployee(EmployeeID)
{
showDialog("教职工档案信息","/School/Employee/basic/Edit.asp?EmployeeID="+EmployeeID,"_blank","dialogTop=0px;dialogWidth=720px;dialogHeight=540px")
return(false)
}
function editStudent(StudentID)
{
//window.open('/School/Student/Basic/Edit.asp?StudentID='+StudentID,'_blank',"top=45,width=725,height=425,left=30,scrollbars=no");
showDialog("学生档案信息",'/School/Student/basic/Edit.asp?StudentID='+StudentID,'_blank',"dialogTop=30px;dialogWidth=735px;dialogHeight=460px");
return(false);
}
function editPaterfamilias(ID)
{
showDialog("学生家长信息",'/School/Student/Family/Edit.asp?ID='+ID,'',"dialogTop=30px;dialogWidth=420px;dialogHeight=350px");
//window.open('/School/Student/Family/Edit.asp?PaterfamiliasID='+ID,'_blank',"top=30,width=725,height=410,left=25,scrollbars=no");
return(false);
}
function editMinistry(ID)
{
window.open('/School/Student/Basic/Edit.asp?ID='+ID,'_blank',"top=30,width=725,height=410,left=25,scrollbars=no");
return(false);
}
function loadMain(content,main)
{
window.parent.frames[1].location=content;
window.parent.frames[2].location=main;
}
function previewURL(theElement)
{ var s=trim(theElement.value);
s=s.toLowerCase();
if(s.indexOf("http://")!=0 || s.length<8)
{ alert("网址为空或者没有包函“http://”说明!")
if(!theElement.disabled && theElement.visabled)
{ theElement.select();
theElement.focus();
}
}
else
window.open(s);
}
function previewEmail(theElement)
{
var s=trim(theElement.value);
if(!isEmail(s))
{ alert("Email地址不合法,不能发信!")
if(!theElement.disabled)
{theElement.select();theElement.focus();}
}
else
window.open("mailto:"+s);
}
//上载文件
//CurFileURL:当前上载的文件FileURL
//FileFormat:文件的类别,如"Jpg;gif"(多种类别时,请用;分开)
//FileSize:文件最大大小(以K为单)
//PathFile:上载的文件路径及文件名(无扩展名)
//Method:处理的方法
// ="post" 转交
// ToString:上载成功后的处理页面Post到ToString文件中
// 注意:处理页面将会自动加上
// FileURL=上载后的文件URL
// FileSize=文件的实际大小
// FileFormat=文件在类别(扩展名)
// Title=对文件的描述
// ="js"
// 将结果按伪JS代码形式写入ToString中
// {%=FileURL%}=上载后的文件URL
// {%=FileSize%}=文
// {%=FileFormat%}=文件在类别(扩展名)
// {%=Title%}=对文件的描述
// =其它
// 直接将上载后的FileURL写入ToString定义的某个域中
function uploadAttach(ProcessString,Method,PubPers)
{
if (typeof(ProcessType)=='undefined') ProcessType="";
if (typeof(PubPers)=='undefined') PubPers="Pub";
if(PubPers=="Pub")
showDialog("政务公共素材上载","/OA/Office/PubFile/Edit.asp?ProcessString=" + escape(ProcessString) +"&Method=" + Method,"","dialogLeft=90px;dialogTop=50px;dialogWidth=620px;dialogHeight=400px");
else
showDialog("个人素材上载","/OA/PersMsg/PersFiles/Edit.asp?ProcessString=" + escape(ProcessString) +"&Method=" + Method,"","dialogLeft=90px;dialogTop=50px;dialogWidth=620px;dialogHeight=400px");
return(false);
}
function setNullIPhoto(imgName,textName)
{
if(window.confirm ("您真想将该图片置空?"))
{
imgName.src=nullPhoto;
textName.value=nullPhoto;
}
}
//显示管理附件
function showAdminAttach(IFrameName,attachXML,Title,Width,Height,isEdit,PubPers)
{
if (typeof(PubPers)=='undefined') PubPers="Pub";
document.write("<iframe ID="+ IFrameName+" frameborder=0 border=0 width="+Width+" Height="+ Height+ " scrolling=no src=/Lib/adminAttach/default.asp?"+
"Title="+escape(Title)+
"&Width="+Width+
"&Height="+Height+
"&attachXML="+escape(attachXML)+
"&isEdit=" +isEdit+
"&PubPers=" +PubPers+
"></iframe>");
}
function toHTML(s)
{
s=Replace(s,"&","&")
s=Replace(s,"<","<")
s=Replace(s,">",">")
return(s);
}
function getAttach(IFrameName)
{
var s="";
var e=eval("document.frames['"+IFrameName+"'].listFile.options");
if(e.length>0)
{s="<sFile>";
for(var i=0;i<e.length;i++)
s+="<File title=\""+toHTML(e[i].text)+"\">"+e[i].value+"</File>";
s+="</sFile>";
}
return(s);
}
//查看源文件
function viewCode()
{
window.location = "view-source:" + window.location.href;
}
function N2(n)
{
return( n<10? "0"+n:n+"");
}
function Add2AtLine(s)
{
var t=s.split("\n");
var ns="";
var n=t.length;
for(i=0;i<n;i++)
{ s=trim(t[i]);
if(t[i]!="")
ns=ns+" "+trim(t[i])+(i<n-1?"\n":"");
else
ns=ns+(i<n-1?"\n":"");
}
return(ns);
}
//将对象objElement前面加两个空格
function splitLine(objElement)
{objElement.value=Add2AtLine(objElement.value);
return(false);
}
function trim(s)
{ var i,r,j
var n=s.length
for(i=0;i<n;i++)
{ t=s.charAt(i)
if(t!=" " && t!=' ') break;
}
if(i==n) return("");
for(j=n-1;j>=0;j--)
{ t=s.charAt(j)
if(t!=" " && t!=' ') break;
}
r=s.substring(i,j+1);
return(r);
}
function isOK(s)
{var n,i;
var c;
n=s.length;
for(i=0;i<n;i++)
{ c=s.charAt(i);
if(!(c>='a' && c<='z' || c>='A' && c<='Z' || c>='0' && c<='9' || c=='_'))
return(false);
}
if(n>=4)
return(true);
else
return(false);
}
function isEmail(s)
{ var n,i,ErrorChar ,j;
ErrorChar=" ~!`#$%^&*()+=?<>,{}[]\\/|'\"";
n=s.length;
if(n<5) return(false);
for(i=0;i<n;i++)
for(j=0;j<ErrorChar.length;j++)
if(s.indexOf(ErrorChar.charAt(j))>=0) return(0);
if(s.indexOf(".")<0||s.indexOf("@")<0 || s.charAt(0)=="@" || s.charAt(n-1)==".")
return(false);
else
return(true);
}
function Bookmarkit()
{
window.external.addFavorite('http://cn.icchina.com','ICChina.com');
}
function random(n)
{
return(Math.floor(Math.random()*n));
}
function Today()
{
var today = new Date();
var centry ;
var s=new Array("日","一","二","三","四","五","六");
centry="";
if(today.getYear()<2000 ) centry = "19" ;
date1 = centry + (today.getYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日" ;
return(date1+" 星期"+s[today.getDay()]);
}
function isDate(y,m,d)
{
var isLeap;
y=y+'';
m=m+'';
d=d+'';
if(isNaN(y)||isNaN(m)||isNaN(d))
return(false);
y=parseInt(y,10);
m=parseInt(m,10);
d=parseInt(d,10);
if(y<1900 || y>2500 || m<1 || m> 12|| d<1 || d>31 || m==2 && d>29)
return(false);
isLeap=(y%4==0 && y%100!=0 || y%400==0);
if(m==2 && !isLeap && m>28) retrun(false);
if(m==2 && isLeap && m>29) return(false);
if((m==4 || m==6 || m==9 || m==11) && d>30)
return(false);
else
return(true);
}
function isStrDate(s)
{
s=trim(s);
var t=s.split("-");
if(t.length==3)
return(isDate(t[0],t[1],t[2]));
else
{ t=s.split(".");
if(t.length==3)
return(isDate(t[0],t[1],t[2]));
else
return(false);
}
}
function isYearMonth(y,m)
{
y=y+'';
m=m+'';
if(isNaN(y)||isNaN(m))
return(false);
y=parseInt(y,10);
m=parseInt(m,10);
if(y<1900 || y>2500 || m<1 || m> 12)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -