📄 function.js
字号:
return(false);
else
return(true);
}
function isStrYearMonth(s)
{
s=trim(s);
var t=s.split("-");
var n=t.length;
if(n==3) return(isDate(t[0],t[1],t[2]));
if(n==2) return(isYearMonth(t[0],t[1]));
t=s.split(".");
n=t.length;
if(n==3) return(isDate(t[0],t[1],t[2]));
if(n==2) return(isYearMonth(t[0],t[1]));
return(false);
}
function Print()
{
window.print();
return(false);
}
function isTime(h,m,s)
{
h=parseInt(h+'',10);
m=parseInt(m+'',10);
if(typeof(s)==undefined)
return(h>=0 && h<24 && m>=0 && m<60)
s=parseInt(m+'',10);
return(h>=0 && h<24 && m>=0 && m<60 && s>=0 && s<60)
}
function isStrTime(s)
{
s=trim(s);
var t=s.split(":");
var n=t.length;
return(isTime(t[0],t[1],t[2]))
}
function isStrDateTime(s)
{
s=Replace(trim(s+''),' ',' ');
var ts=s.split(" ");
if (ts.length==1)
return(isStrDate(s));
else
return(isStrDate(ts[0]) && isStrTime(ts[1]))
}
function ShowSelectFor1A(s,Name,cv,w,Title)
{
var aS=s.split("|")
var n=aS.length;
document.write("<select Name="+Name +" style='width:"+w+"'>");
if(Title!="")
document.write("<option value=''>"+Title+"</option>");
for(var i=0;i<n;i++)
{ document.write("<option value="+aS[i]+ (aS[i]==cv?" selected":"")+">"+aS[i]+"</option>");
}
document.write("</select>");
}
function SetHomePage(This)
{
This.style.behavior='url(#default#homepage)';
This.setHomePage('http://ibs.aixi.net/Edu50/');
return(false);
}
//显示二维数组列表
// s:数组名
//Name:Select Name名
// cv :当前的值
// w :当前的列表的宽度
// Title:第一项空白显示的标题,如"(选择民族)"
// SplitChar:主类与子类的分隔符
function ShowSelectFor2A(s,Name,cv,w,Title,SplitChar)
{ var i,j,mItem,sItem;
var ts,cC,mC;
var n=s.length;
if (typeof(SplitChar)=='undefined') SplitChar="";
if (typeof(Title)=='undefined') Title="(选择?)";
document.write("<select name=" + Name + " style='width:"+w+"'>");
if(Title!="") document.write("<option value=''>"+Title+"</option>");
for(i=0;i<n;i++)
{ ts=s[i].split(":")
sItem=ts[1].split("|");
document.write("<option value=" + ts[0] + (ts[0]==cv?" selected":"") + ">"+((i==n-1)?"└ ":"├ ") + ts[0]+"</option>");
if(ts[1]!="")
for(j=0;j<sItem.length;j++)
{ cC=ts[0]+ SplitChar+ sItem[j];
ss=(i==(n-1)?" ":"│")+(j==(sItem.length-1)?"└ ":"├ ");
document.write("<option value='"+cC + (cv==cC?"' selected":"'")+">" + ss + sItem[j]+"</option>");
}
}
document.write("</select>");
}
function ShowGrade(Name,cv,w,Title)
{
var s=new Array(
"幼儿园:小班|中班|大班",
"小学:一年级|二年级|三年级|四年级|五年级|六年级",
"初中:一年级|二年级|三年级|四年级",
"高中:一年级|二年级|三年级|四年级",
"中专:一年级|二年级|三年级|四年级",
"大学:一年级|二年级|三年级|四年级|五年级",
"其它:");
ShowSelectFor2A(s,Name,cv,w,Title);
}
function ShowProvince(Name,cv,w,Title) //显示省份名
{
var Citys="北京|上海|重庆|天津|湖北|吉林|安徽|福建|甘肃|广西|浙江|江苏|江西|宁夏|贵州|海南|河北|云南|辽宁|内蒙古|青海|黑龙江|陕西|西藏|台湾|山东|山西|河南|湖南|广东|四川|新疆|香港|澳门|台湾";
ShowSelectFor1A(Citys,Name,cv,w,Title)
}
function ShowNation(Name,cv,w,Title) //显示民民族
{
var s="汉族|回族|藏族|维吾尔|蒙古族|苗族|彝族|壮族|布依族|朝鲜族|满族|侗族|瑶族|白族|土家族|哈尼族|哈萨克族|傣族|黎族|傈僳族|佤族|畲族|高山族|拉祜族|水族|东乡族|纳西族|景颇族|柯尔克孜族|土族|达斡尔族|仫佬族|羌族|布朗族|撒拉族|毛南族|仡佬族|锡伯族|阿昌族|普米族|塔吉克族|怒族|乌孜别克族|俄罗斯族|鄂温克族|德昂族|保安族|裕固族|京族|塔塔尔族|独龙族|鄂伦春族|赫哲族|门巴族|珞巴族|基诺族"
ShowSelectFor1A(s,Name,cv,w,Title);
}
//'显示学历水平的Select
function ShowLevel(Name,cv,w,Title)
{
var s="本科|专科|中专|高中|初中|小学|硕士|博士|博士后|文盲";
ShowSelectFor1A(s,Name,cv,w,Title);
}
//显示上载文件的列表情况
//s : 文件列表情况
// 格式为
// 文件1的描述\t文件1URL\n
// 文件2的描述\t文件2URL\n
// ...
// 文件n的描述\t文件nURL
//Name:select 列表名
// w:宽度
// h:高度
//返回:当前的文件个数
function showFileList(s,Name,w,h)
{ var n=0;
if(typeof(h)=='undefined') h="20";
var ts=s.split("\n");
document.write("<select Name=" +Name+ " style='width:" +w+ ";height:" +h+"'>");
for( var i=0;i<ts.length;i++)
{ if(ts[0]!="")
{ vf=ts[0].split("\t") //分解文件描述 文件URL
if(vf.length=2 && vf[1]!="")
{
n++;
if(vf[0]=="") vf[0]=vf[1]; //没有文件描述,则使用文件名作描述
document.write("<option value='" + vf[1] +"'>"+vf[0]+"</option>");
}
}
}
document.write("</select>");
}
//取得当前用户上载的文件列表信息,并将写入某个字段域中
function getFileList(objName,objTextName)
{
var s="";
objName=objName.options
for(var i=0;i<objName.length;i++)
s+=objName[i].text+"\t"+objName[i].value+"\n";
objTextName.value=s;
}
//取得主文件名
function getFileName(FileURL)
{
var s=FileURL.split("/");
if(s.length>0)
{ ts=s[s.length-1].split(".")
return(ts[0]);
}
else
return("");
}
function setClass(t,Type)
{
t.className =Type;
}
function selectAll(theButton,theForm,checkName)
{ if(typeof(theButton)=="object")
var s=theButton.checked;
else
s=theButton;
for(i=0;i<theForm.elements.length;i++)
{ var e=theForm.elements[i];
if(e.name==checkName && !e.disabled) e.checked=s;
}
}
function closeWindow()
{var e=document.getElementsByTagName("INPUT")
for(i=0;i<e.length;i++)
if(e[i].type=="submit" && !e[i].disabled)
{ if(window.confirm ("您确认放弃当前的编辑?"))
this.close();
return(false)
}
this.close();
}
//编辑个人资料分类
// Title: 分类说明,如个人Email、个人图库
//tableName:当前使用的表名
function persCategory(Title,tableName,spanName)
{if(typeof(spanName)=="undefined") spanName="";
showDialog(Title+'分类管理',"/Lib/Category/default.asp?PubPers=Pers&Title="+escape(Title)+"&Kind="+tableName+"&spanName="+spanName,"", "dialogTop=20px;dialogWidth=430px;dialogHeight=390px;");
return(false);
}
//用户选某个类别
function selectCategory(xmlDoc,selectName)
{
showDialog("选择分类","/Lib/Category/Select.asp?xmlDoc="+xmlDoc+"&selectName="+selectName,"","dialogLeft=200px;dialogWidth=450px;dialogHeight=400px;dialogTop=100px;")
return(false);
}
//编辑学校公共资料分类
// Title: 分类说明,如校园新闻、校园设备
//tableName:当前使用的表名
function pubCategory(Title,tableName,spanName)
{if(typeof(spanName)=="undefined") spanName="";
showDialog(Title+'分类管理',"/Lib/Category/default.asp?PubPers=Pub&Title="+escape(Title)+"&Kind="+tableName+"&spanName="+spanName,"", "dialogTop=20px;dialogWidth=430px;dialogHeight=390px;");
return(false);
}
function showCategorySelect(xmlDoc,Name,cv,w,Title)
{ var node;
if(typeof(xmlDoc)=="string")
{
var fn=xmlDoc;
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async = false;
xmlDoc.load(fn);
}
if(xmlDoc!=null)
node=xmlDoc.selectSingleNode("/sCategory/Category");
else
node=null;
s="<select Name="+Name +" style='width:"+w+"'>";
if(Title!="")
s+="<option value=''>"+Title+"</option>";
for(;node!=null;node=node.nextSibling)
{
Title=node.getAttribute("Title");
Description=node.text;
showChar=node.getAttribute("showChar");
Category=node.getAttribute("Category");
Catgeory=Category.replace("'","'")
Catgeory=Category.replace("\n","")
s+="<option title='"+ Description +"' value='"+Category+"' "+(Category==cv?" selected":"")+">"+showChar+" "+ Title+"</option>";
}
s+="</select>";
return(s);
}
function showHtmlEditor(idName,PubPers,initContentField,Width,Height)
{
document.write("<iframe ID=" +idName+ " frameborder=0 border=0 width='"+Width+"' Height='"+ Height+ "' scrolling='no' src=/Lib/htmlEditor/default.asp?"+
"PubPers="+escape(PubPers)+
"&initContentField=" +escape(initContentField)+
"&Width="+Width+
"&Height="+Height+
"></iframe>");
}
function setHtmlEditorStatus(idName,status)
{
var e=window.frames[idName];
e.document.setEditStatus(status);
}
function getHtmlEditorContent(idName)
{
var e=eval("document.frames['"+idName+"'].document")
var format=e.Editor.document.body.Format;
if(format=="Html")
return(e.Editor.document.body.innerText);
else
return(e.Editor.document.body.innerHTML);
}
function setUpDownClass(elementName,className)
{
elementName.className="d"+className;
return(false);
}
// Title: 对话框标题
// resultType:结果类别
// file或imgFile: 仅是文件/图片文件
// 返回: file标题\n文件URL
// link: 连接
// 返回当前的连接HTML代码
// img :图片连接
// 返回当前的图片连接HTML代码
// 取消时,返回空字符串
function openResource(Title,resultType,PubPers)
{
if(typeof(PubPers)=="undefined") PubPers="Pub";
if(PubPers=="Pub")
var fileName=window.showModalDialog("/Lib/Resource/selectOpen.asp?Title="+escape(Title)+"&resultType="+resultType,"","dialogHeight: 456px; dialogWidth: 725px; center: Yes; help: No; resizable: No; status: No; scrollbars :no");
else
var fileName=window.showModalDialog("/Lib/PersResource/selectOpen.asp?Title="+escape(Title)+"&resultType="+resultType,"","dialogHeight: 456px; dialogWidth: 725px; center: Yes; help: No; resizable: No; status: No; scrollbars :no");
return(fileName)
}
//Title:对话框标题
//Kind:类别,可含如下字符:D 教育组(局)用户 E 学校教工 S 学生用户 P 家长
//isMuli:可否多选 true 可以 false 单选
//返回值:
// 确认时
// 用户名1\t用户1ID号\n
// ......
// 用户名n\t用户nID号\n
// 取消时: 空字符串
function openUser(Title,Kind,isMuli,userName,userStyle)
{
var s=typeof(userName);
if(s=="object")
{s=""
for(var i=0;i<userName.options.length;i++)
s+=userName.options[i].text+"<"+ userName.options[i].value+">;"
}
else
if(s=="string")
s=userName;
else
s="";
if(typeof(userStyle)=="undefined")
userStyle="0";
else
if(userStyle!="1" && userStyle!="2") userStyle="0";
var userList="";
switch(userStyle)
{ case "0":
useList=window.showModalDialog("/Lib/selectUser/default.asp?Title="+escape(Title)+"&Kind="+Kind+"&isMuli="+isMuli+"&UserName="+escape(s),"","dialogHeight: 456px; dialogWidth: 725px; center: Yes; help: No; resizable: No; status: No; scrollbars :no");
break;
case "1":
useList=window.showModalDialog("/Lib/selectUser/defaultUser.asp?Title="+escape(Title)+"&Kind="+Kind+"&isMuli="+isMuli+"&UserName="+escape(s),"","dialogHeight: 456px; dialogWidth: 725px; center: Yes; help: No; resizable: No; status: No; scrollbars :no");
break;
default:
useList=window.showModalDialog("/Lib/selectUser/defaultNoUser.asp?Title="+escape(Title)+"&Kind="+Kind+"&isMuli="+isMuli+"&UserName="+escape(s),"","dialogHeight: 456px; dialogWidth: 725px; center: Yes; help: No; resizable: No; status: No; scrollbars :no");
break;
}
return(useList);
}
function showDepartment(ID,w,h,Kind,initValue)
{
document.write("<iframe ID=" +ID+ " frameborder=1 border=0 width='"+w+"' Height='"+ h+ "' scrolling=yes src=/Lib/selectUser/selectDepartment.asp?"+
"Kind="+escape(Kind)+
"&initValue=" +escape(initValue)+
"></iframe>");
}
function getDepartment(IDIFrame)
{
return(IDIFrame.getDepartment());
}
//禁止窗体内容进行编辑
// theForm:需要禁止的窗体
// elseElementNames:哪些元素除外
function disabledForm(theForm,elseElementNames)
{
elseElementNames=elseElementNames+"";
if(elseElementNames=="undefined") elseElementNames="";
elseElementNames=","+elseElementNames+",";
var s="";
for(var i=0;i< theForm.elements.length;i++)
{
e=theForm.elements[i];
if(elseElementNames.indexOf(","+e.name+",")==-1)
{
s+=e.tagName+","+e.type+"\n";
switch(e.tagName)
{
case "INPUT":
switch(e.type)
{
case "text":
e.style.backgroundColor="#d0d0c8";
e.readOnly=true;
break;
case "submit":
case "reset":
case "button":
case "radio":
case "checkbox":
case "password":
case "file":
e.disabled=true;
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -