⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.js

📁 Jbuilder2006开发的严格按MVC设计模式组织开发过程
💻 JS
字号:
var week=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");

String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function OMO() {
    if (window.event.srcElement.tagName == "IMG")
        event.srcElement.parentElement.className="T";
    else
        event.srcElement.className="T";
}

function OMOU() {
    if (window.event.srcElement.tagName == "IMG")
        event.srcElement.parentElement.className="T";
    else
        event.srcElement.className="P";
}

function OMO1() {
	event.srcElement.className="LL";
}

function openWindow(URL, Name, Width, Height) {
	window.open(URL, Name, "width=" + Width + ",height=" + Height +
				",left=" + (window.screen.width - Width)/2 +
				",top=" + (window.screen.height - Height)/2 +
				",resizable=no,scrollbars=yes,toolbar=no,location=no," +
				"directories=no,status=no,menubar=no");
}

function openDialog(URL, Arguments, Width, Height) {
	window.showModalDialog(URL, Arguments, "dialogWidth:" + Width + "px; dialogHeight:" + Height +"px; center:yes; resizable:no; scroll:yes; status:yes");
}

function openWaiting(URL, Arguments) {
	window.showModelessDialog(URL, Arguments, "dialogWidth:300px;dialogHeight:100px;center:yes; resizable:no; scroll:no; status:no; unadorned:no;");
}

function load() {
  getMyTime();
  window.setInterval("getMyTime()", 1000);
}

function logout() {
//  var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
//  xmlhttp.open("POST","/RAILWAY/aLogonInfoAction.do?method=logout",false);  // 发送更新请求
//  xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
//  xmlhttp.send();
window.location="<%=request.getContextPath()%>/aLogonInfoAction.do?method=logout";
}

function closeAlert() {
  if (confirm("您要退出系统,确定吗?")){
    logout();
    return true;
  } else {
    return false;
  }
}

function initArray(){
  this.length=initArray.arguments.length
  for(var i=0;i<this.length;i++)
  this[i+1]=initArray.arguments[i]
}

function getMyTime(){
   var now, hour, minute, date = "", time = "", weekname = "";
   now = new Date();
   hour = now.getHours();
   minute = now.getMinutes();
   second = now.getSeconds();
   if (hour < 10) {
   hour = "0" + hour;
   }
   if (minute < 10) {
   minute = "0" + minute;
   }
   if (second < 10) {
   second = "0" + second;
   }
   if(hour < 6){time += "凌晨";}
   else if (hour < 9){time += "早上";}
   else if (hour < 12){time += "上午";}
   else if (hour < 14){time += "中午";}
   else if (hour < 17){time += "下午";}
   else if (hour < 19){time += "傍晚";}
   else if (hour < 22){time += "晚上";}
   else {time += "夜里";}
   date = now.getYear() + "年" +  (now.getMonth()+1) + "月" + now.getDate() + "日 ";
   time += " " + hour + ":" + minute + ":" + second;
   weekname = week[now.getDay()+1];
   document.all.time.innerText = time;
   document.all.date.innerText = date;
   document.all.week.innerText = weekname;
}

//-------------------------------------------------------
/*-------------------
  显示隐藏loading层
--------------------*/
function ceter_loadingDIV(){
  var div1 = document.getElementById("loading_div");
  //alert(div1.style.height+":::::"+div1.style.width);
  div1.style.posLeft = (document.body.offsetWidth - div1.clientWidth) / 2 -180;
  div1.style.posTop = (document.body.offsetHeight - div1.clientHeight) / 2 -100;
//  div1.style.posLeft = (document.body.offsetWidth - div1.clientWidth) / 2 + document.body.scrollLeft;
//  div1.style.posTop = (document.body.offsetHeight - div1.clientHeight) / 2 + document.body.scrollTop;
  var div = document.createElement("<div id='filter_div' class='dis' oncontextmenu='return false;'>");
  var iframe = document.createElement("<iframe id='filter_iframe' class='dis' style='z-index:98;'>");
  document.getElementsByTagName("body")[0].appendChild(iframe);
  document.getElementsByTagName("body")[0].appendChild(div);
  div1.style.display='';
}

function cancel_loadingDIV(){
  var div1 = document.getElementById("loading_div");
  var div=document.getElementById("filter_div");
  var iframe=document.getElementById("filter_iframe");
  document.getElementsByTagName("body")[0].removeChild(div);
  document.getElementsByTagName("body")[0].removeChild(iframe);
  div1.style.display='none';
}
//---------------------------------------------------------------------------------
function selectAll(object) {
  if (document.all.del_checkbox_id != null) {
    if (object.checked == true) {
      if (document.all.del_checkbox_id.length == null) {
        document.all.del_checkbox_id.checked = true;
      }
      else {
        for (var i = 0; i < document.all.del_checkbox_id.length; i++) {
          document.all.del_checkbox_id[i].checked = true;
        }
      }
    }
    else {
      if (document.all.del_checkbox_id.length == null) {
        document.all.del_checkbox_id.checked = false;
      }
      else {
        for (var i = 0; i < document.all.del_checkbox_id.length; i++) {
          document.all.del_checkbox_id[i].checked = false;
        }
      }
    }
  }
}
function deleteRow(obj){
  var tbl=obj.parentElement.parentElement.parentElement;
  var tr=obj.parentElement.parentElement;
  tbl.removeChild(tr);
  if(tbl.rows.length==1){
    var row=tbl.insertRow();
    row.align='center';
    var cell=row.insertCell();
    cell.height='20';
    cell.colSpan=tbl.rows[0].cells.length;
    cell.innerHTML='没有数据';
  }
}

//--------------------------------------------------------------------------
/*-------------------
  展开或折叠列表
--------------------*/
var oldObj='';
function showDetail(obj,root){
  var upExpand=false;
  var tbl=document.all.PowerTable;
  for(var i=0;i<tbl.rows.length;i++){
    if(tbl.rows[i].style.display=="block"){
      tbl.rows[i].style.display="none";
      upExpand=true;
      break;
    }
  }
  if(upExpand==true){
    tbl.rows[parseInt(i)-1].cells[tbl.rows[parseInt(i)-1].cells.length-1].innerHTML='<img src="'+root+'/_normal/toolbar_pic/unwrap.gif" alt="展开详细列表" onClick="showDetail(this,\''+root+'\')" style="cursor:hand">';
  }
  for(var j=1;j<tbl.rows.length;j++){
    if(obj.parentElement.parentElement==tbl.rows[j]){
      break;
    }
  }
  tbl.rows[parseInt(j)+1].style.display='block';
  obj.parentElement.innerHTML='<img src="'+root+'/_normal/toolbar_pic/furl.gif" alt="折叠详细列表" onClick="disShowDetail(this,\''+root+'\')" style="cursor:hand">';
}
function disShowDetail(obj,root){
  var tbl=document.all.PowerTable;
  for(var i=1;i<tbl.rows.length;i++){
    if(obj.parentElement.parentElement==tbl.rows[i]){
      break;
    }
  }
  tbl.rows[parseInt(i)+1].style.display='none';
  obj.parentElement.innerHTML='<img src="'+root+'/_normal/toolbar_pic/unwrap.gif" alt="展开详细列表" onClick="showDetail(this,\''+root+'\')" style="cursor:hand">';
}
//------------------------------------------------------------------------
var pageIdSeed=1;
function getNextPageId(){
  return pageIdSeed++;
}


⌨️ 快捷键说明

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