smsedit.aspx

来自「该服务平台解决了计算机网络与移动网络之间信息交换问题」· ASPX 代码 · 共 753 行 · 第 1/3 页

ASPX
753
字号
//根据标签id隐藏或显示标签
function hideElementsById(arrId,bolHide){
 var strDisplay = "";
 if(bolHide) strDisplay = "none";
 for(var i = 0;i < arrId.length;i ++){
  var obj = document.getElementById(arrId[i]);
  obj.style.display = strDisplay;
 }
}
//------------------ end 显示日期时间的span标签响应事件 ---------------------------//
//判断某年是否为闰年
function isPinYear(year){
 var bolRet = false;
 if (0==year%4&&((year%100!=0)||(year%400==0))) {
  bolRet = true;
 }
 return bolRet;
}
//得到一个月的天数,闰年为29天
function getMonthCount(year,month){
 var c=m_aMonHead[month-1];
 if((month==2)&&isPinYear(year)) c++;
 return c;
}
//重新设置当前的日。主要是防止在翻年、翻月时,当前日大于当月的最大日
function setRealDayCount() {
 if( tiannetDay > getMonthCount(tiannetYear,tiannetMonth) ) {
  //如果当前的日大于当月的最大日,则取当月最大日
  tiannetDay = getMonthCount(tiannetYear,tiannetMonth);
 }
}
//在个位数前加零
function addZero(value){
 if(value < 10 ){
  value = "0" + value;
 }
 return value;
}
//取出空格
function tiannetTrim(str) {
 return str.replace(/(^\s*)|(\s*$)/g,"");
}
//为select创建一个option
function createOption(objSelect,value,text){
 var option = document.createElement("OPTION");
 option.value = value;
 option.text = text;
 objSelect.options.add(option);
}
//往前翻 Year
function tiannetPrevYear() {
 if(tiannetYear > 999 && tiannetYear <10000){tiannetYear--;}
 else{alert("年份超出范围(1000-9999)!");}
 tiannetSetDay(tiannetYear,tiannetMonth);
 //如果年份小于允许的最小年份,则创建对应的option
 if( tiannetYear < tiannetYearSt ) {
  tiannetYearSt = tiannetYear;
  createOption(document.all.selTianYear,tiannetYear,tiannetYear + "年");
 }
 checkSelect(document.all.selTianYear,tiannetYear);
 tiannetWriteHead();
}
//往后翻 Year
function tiannetNextYear() {
 if(tiannetYear > 999 && tiannetYear <10000){tiannetYear++;}
 else{alert("年份超出范围(1000-9999)!");return;}
 tiannetSetDay(tiannetYear,tiannetMonth);
 //如果年份超过允许的最大年份,则创建对应的option
 if( tiannetYear > tiannetYearEnd ) {
  tiannetYearEnd = tiannetYear;
  createOption(document.all.selTianYear,tiannetYear,tiannetYear + "年");
 }
 checkSelect(document.all.selTianYear,tiannetYear);
 tiannetWriteHead();
}
//选择今天
function tiannetToday() {
 tiannetYear = tiannetDateNow.getFullYear();
 tiannetMonth = tiannetDateNow.getMonth()+1;
 tiannetDay = tiannetDateNow.getDate();
 tiannetSetValue(true);
 //tiannetSetDay(tiannetYear,tiannetMonth);
 //selectObject();
}
//往前翻月份
function tiannetPrevMonth() {
 if(tiannetMonth>1){tiannetMonth--}else{tiannetYear--;tiannetMonth=12;}
 tiannetSetDay(tiannetYear,tiannetMonth);
 checkSelect(document.all.selTianMonth,tiannetMonth);
 tiannetWriteHead();
}
//往后翻月份
function tiannetNextMonth() {
 if(tiannetMonth==12){tiannetYear++;tiannetMonth=1}else{tiannetMonth++}
 tiannetSetDay(tiannetYear,tiannetMonth);
 checkSelect(document.all.selTianMonth,tiannetMonth);
 tiannetWriteHead();
}
//向span标签中写入年、月、时、分等数据
function tiannetWriteHead(){
 document.all.tiannetYearHead.innerText = tiannetYear + "年";
 document.all.tiannetMonthHead.innerText = tiannetMonth + "月";
 if( m_bolShowHour )  document.all.tiannetHourHead.innerText = " "+tiannetHour + "时";
 if( m_bolShowMinute ) document.all.tiannetMinuteHead.innerText = tiannetMinute + "分";
 tiannetSetValue(false);//给文本框赋值,但不隐藏本控件
}
//设置显示天
function tiannetSetDay(yy,mm) {
  
 setRealDayCount();//设置当月真实的日
 tiannetWriteHead();
 var strDateFont1 = "", strDateFont2 = "" //处理日期显示的风格
 for (var i = 0; i < 37; i++){tiannetArrDay[i]=""};  //将显示框的内容全部清空
 var day1 = 1;
 var firstday = new Date(yy,mm-1,1).getDay();  //某月第一天的星期几
 for (var i = firstday; day1 < getMonthCount(yy,mm)+1; i++){
  tiannetArrDay[i]=day1;day1++;
 }
 //如果用于显示日的最后一行的第一个单元格的值为空,则隐藏整行。
 //if(tiannetArrDay[35] == ""){
 // document.all.trTiannetDay5.style.display = "none";
 //} else {
 // document.all.trTiannetDay5.style.display = "";
 //}
 for (var i = 0; i < 37; i++){ 
  var da = eval("document.all.tdTiannetDay"+i)     //书写新的一个月的日期星期排列
  if (tiannetArrDay[i]!="") { 
   //判断是否为周末,如果是周末,则改为红色字体
   if(i % 7 == 0 || (i+1) % 7 == 0){
   strDateFont1 = "<font color=#f0000>"
   strDateFont2 = "</font>"
   } else {
    strDateFont1 = "";
    strDateFont2 = ""
   }
   da.innerHTML = strDateFont1 + tiannetArrDay[i] + strDateFont2;
   //如果是当前选择的天,则改变颜色
   if(tiannetArrDay[i] == tiannetDay ) {
    da.style.backgroundColor = "#CCCCCC";
   } else {
    da.style.backgroundColor = "#EFEFEF";
   }
   da.style.cursor="hand"
  } else {
   da.innerHTML="";da.style.backgroundColor="";da.style.cursor="default"
  }
 }//end for
 tiannetSetValue(false);//给文本框赋值,但不隐藏本控件
}//end function tiannetSetDay
//根据option的值选中option
function checkSelect(objSelect,selectValue) {
 var count = parseInt(objSelect.length);
 if( selectValue < 10 && selectValue.toString().length == 2) {
  selectValue = selectValue.substring(1,2);
 }
 for(var i = 0;i < count;i ++){
  if(objSelect.options[i].value == selectValue){
   objSelect.selectedIndex = i;
   break;
  }
 }//for
}
//选中年、月、时、分等下拉框
function selectObject(){
 //如果年份小于允许的最小年份,则创建对应的option
 if( tiannetYear < tiannetYearSt ) {
  for( var i = tiannetYear;i < tiannetYearSt;i ++  ){
   createOption(document.all.selTianYear,i,i + "年");
  }
  tiannetYearSt = tiannetYear;
 }
 //如果年份超过允许的最大年份,则创建对应的option
 if( tiannetYear > tiannetYearEnd ) {
  for( var i = tiannetYearEnd+1;i <= tiannetYear;i ++  ){
   createOption(document.all.selTianYear,i,i + "年");
  }
  tiannetYearEnd = tiannetYear;
 }
 checkSelect(document.all.selTianYear,tiannetYear);
 checkSelect(document.all.selTianMonth,tiannetMonth);
 if( m_bolShowHour )  checkSelect(document.all.selTianHour,tiannetHour);
 if( m_bolShowMinute ) checkSelect(document.all.selTianMinute,tiannetMinute);
}
//给接受日期时间的控件赋值
//参数bolHideControl - 是否隐藏控件
function tiannetSetValue(bolHideControl){
 var value = "";
 if( !tiannetDay || tiannetDay == "" ){
  tiannetOutObject.value = value;
  return;
 }
 var mm = tiannetMonth;
 var day = tiannetDay;
 if( mm < 10 && mm.toString().length == 1) mm = "0" + mm;
 if( day < 10 && day.toString().length == 1) day = "0" + day;
 value = tiannetYear + tiannetDateSplit + mm + tiannetDateSplit + day;
 if( m_bolShowHour ){
  var hour = tiannetHour;
  if( hour < 10 && hour.toString().length == 1 ) hour = "0" + hour;
  value += tiannetDateTimeSplit + hour;
 }
 if( m_bolShowMinute ){
  var minute = tiannetMinute;
  if( minute < 10 && minute.toString().length == 1 ) minute = "0" + minute;
  value += tiannetTimeSplit + minute;
 }
 tiannetOutObject.value = value;
 //document.all.divTiannetDate.style.display = "none";
 if( bolHideControl ) {
  tiannetHideControl();
 }
}
//是否显示时间
function showTime(){
 if( !m_bolShowHour && m_bolShowMinute){
  alert("如果要选择分钟,则必须可以选择小时!");
  return;
 }
 hideElementsById(new Array("tiannetHourHead","selTianHour","tiannetMinuteHead","selTianMinute"),true);
 if( m_bolShowHour ){
  //显示小时
  hideElementsById(new Array("tiannetHourHead"),false);
 }
 if( m_bolShowMinute ){
  //显示分钟
  hideElementsById(new Array("tiannetMinuteHead"),false);
 }
}
//弹出显示日历选择控件,以让用户选择
function tiannetPopCalendar(){
 //隐藏下拉框,显示相对应的head
 hideElementsById(new Array("selTianYear","selTianMonth","selTianHour","selTianMinute"),true);
 hideElementsById(new Array("tiannetYearHead","tiannetMonthHead","tiannetHourHead","tiannetMinuteHead"),false);
 tiannetSetDay(tiannetYear,tiannetMonth);
 tiannetWriteHead();
 showTime();
 var dads  = document.all.divTiannetDate.style;
 var iX, iY;
  
 var h = document.all.divTiannetDate.offsetHeight;
 var w = document.all.divTiannetDate.offsetWidth;
 //计算left
 if (window.event.x + h > document.body.offsetWidth - 10    )
  iX = window.event.x - h - 5 ;
 else
  iX = window.event.x + 5;  
 if (iX <0)  
  iX=0;
 //计算top
 iY = window.event.y;
 if (window.event.y + w > document.body.offsetHeight - 10   )

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?