📄 newcalendar.js
字号:
function opencalendar_E( strid)
{
var calwin=window.open("../tools/Calendar_E.htm","Calendar","height = 280, width = 250");
calwin.opener=window;
form1.clicksource.value='form1.'+strid;
form1.clickresult.value='';
}
function openClock_E( strid)
{
var calwin=window.open("../tools/Clock_E.htm","Clock","height = 40, width = 180");
calwin.opener=window;
form1.clicksource.value='form1.'+strid;
form1.clickresult.value='';
}
function opencalendar_C( strid)
{
var calwin=window.open("../tools/Calendar_C.htm","日历","height = 280, width = 250");
calwin.opener=window;
form1.clicksource.value='form1.'+strid;
form1.clickresult.value='';
}
function openClock_C( strid)
{
var calwin=window.open("../tools/Clock_C.htm","时间","height = 40, width = 180");
calwin.opener=window;
form1.clicksource.value='form1.'+strid;
form1.clickresult.value='';
}
function setTimeDate(strid)
{
var strTimeDate = strid.value;
var strTime,strDate;
var IsVali,IndexBlank;
var ObjName = strid.name.replace('dup','');
if((strid.name.indexOf('Time') >-1)||(strid.name.indexOf('time') >-1)){
/////需要输入时间
IsVali=check_time(strTimeDate);
if (IsVali==1){//时间是否有效
alert("时间值错误");
strid.value="";
return false;
}
else{
document.all.item(ObjName).value=strid.value;
}
}
else{
////////输入日期或同时输入时间和日期
if (strid.value.indexOf(':') >-1){
///////同时输入了时间和日期
IndexBlank = strid.value.indexOf(' ');
if (IndexBlank >-1){//日期与时间之间有空格
if (IndexBlank < strid.value.indexOf(':')){//时间在日期后面
strDate = strid.value.substring(0,IndexBlank);
strTime = strid.value.substring(IndexBlank+1,strid.value.length);
if (strDate!='') {//有日期
IsVali = check_date(strDate);//判断日期是否合格
if (IsVali==1) {//不合格
alert(ErrMsg[5]);
strid.value = strid.value.replace(strDate,'');//消除用户输入的错误日期
return false;
}
}
else if ((strTime!='')&&(strTime!=':')){//有时间
IsVali = check_time(strTime);//判断时间是否合格
if(IsVali==1){//不合格
alert("时间值错误");
strid.value = strid.value.replace(strTime,'');//消除用户输入的错误时间
return false;
}
}
}
else{//既无时间也无日期,判为非法格式
alert("非法的日期时间格式!");
strid.value ="";
return false;
}
document.all.item(ObjName).value = strid.value;
}
else{
//////时间与日期的表示没有用空格分开,判为非法格式
alert("非法的日期时间格式!");
strid.value = strid.value.replace(strTimeDate,'');
return false;
}
}
else{//输入日期
IsVali=check_date(strTimeDate);
// alert("Date,"+IsVali);
if ((IsVali==1)&&(strTimeDate!='')){//日期无效
alert(ErrMsg[5]);
strid.value="";
return false;
}
else{
document.all.item(ObjName).value=strid.value;
}
}
}
return true;
}
function returndate()
{
if(form1.clicksource.value!='')
{
var tempobj=eval(form1.clicksource.value);
//alert(form1.clicksource.value);
//alert(tempobj);
tempobj.value=form1.clickresult.value;
var tempmainstr = form1.clicksource.value;
var tempmainstr1 = form1.clicksource.value;
var tempotherstr = form1.clicksource.value;
var tempmain = null;
var tempother = null;
var tempmain1 = null
if(form1.clicksource.value.indexOf('date') > -1)
{
//that is dateN clicked.
tempotherstr=form1.clicksource.value.replace('date','time');
tempmainstr = form1.clicksource.value.replace('date','datetime');
tempmainstr1 = form1.clicksource.value.replace('date','dupdatetime');
tempmain = eval(tempmainstr);
tempmain1 = eval(tempmainstr1);
tempother = eval(tempotherstr);
//alert(tempmain);
if (tempmain!=null) tempmain.value = tempobj.value; // + ' ' + tempother.value;
tempmain1.value = tempobj.value; // + ' ' + tempother.value;
}
else if(form1.clicksource.value.indexOf('time') > -1)
{
//that is timeN clicked.
tempotherstr=form1.clicksource.value.replace('time','date');
tempmainstr = form1.clicksource.value.replace('time','datetime');
tempmainstr1 = form1.clicksource.value.replace('time','dupdatetime');
tempmain1 = eval(tempmainstr1);
tempmain = eval(tempmainstr);
tempother = eval(tempotherstr);
tempmain.value = tempother.value + ' '+ tempobj.value ;
tempmain1.value = tempother.value + ' '+ tempobj.value ;
}
else
{
//something unexpected happen.
return;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -