📄 javascript.js
字号:
// JavaScript Document
function findObj(theObj, theDoc)
{
var p, i, foundObj;
if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
{
theDoc = parent.frames[theObj.substring(p+1)].document;
theObj = theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
for (i=0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[i][theObj];
for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj,theDoc.layers[i].document);
if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
return foundObj;
}
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span");
if(el.style.display != "block"){
for (var i=0; i<ar.length; i++){
if (ar[i].className=="Menu2_Bg")
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
/********start add channel public js by wangzhaowu 2005-6-28*/
/**
*页面初始化时加载表格的tr样式(隔行换色)
*param tableID:需要隔行还色的table的id
*param hasTitle:boolean值 true:表格具有标题,false:表格没有标题
*/
function loadTableStyle(tableID,hasTitle){
var tb=document.all(tableID);
tb.className="tb";
tb.borderColor="#B3E1F0";
var i=0;
if(hasTitle){
tb.rows[0].className="tr_title";
i=1;
}
var len=tb.rows.length;
for(;i<len;i++){
if(i%2==0){
tb.rows[i].className="border_RightBottom";
}else{
tb.rows[i].className="border_RightBottom2";
}
}
}
function loadTableStyle2(tableID,hasTitle){
var tb=document.all(tableID);
tb.className="tb";
tb.borderColor="#B3E1F0";
var i=0;
if(hasTitle){
tb.rows[0].className="tr_title";
i=1;
}
var len=tb.rows.length;
for(;i<len;i++){
tb.rows[i].className="border_RightBottom3";
}
}
/**
* 禁用当前处理中的特定控件,仅供动态页面TAG调用
*/
function disableControl(processID, itemID) {
document.all[processID + "_" + itemID].disabled = true;
}
/**
* 得到YYYY-MM-DD hh:mm:ss格式的当前日期时间
*/
function getNowDateTime() {
var now=new Date();
var year=now.getYear();
var month=now.getMonth()+1;
var date=now.getDate();
var hh=now.getHours();
var mm=now.getMinutes();
var ss=now.getSeconds();
if (month < 10){month = "0" + month;}
if (date < 10){date = "0" + date;}
if (hh < 10){hh = "0" + hh;}
if (mm < 10){mm = "0" + mm;}
if (ss < 10){ss = "0" + ss;}
var dt=year+"-"+month+"-"+date+" "+hh+":"+mm+":"+ss;
return dt;
}
/**
* 得到YYYY-MM-DD格式的当前日期
*/
function getNowDate() {
var now=new Date();
var year=now.getYear();
var month=now.getMonth()+1;
var date=now.getDate();
if (month < 10){month = "0" + month;}
if (date < 10){date = "0" + date;}
var dt=year+"-"+month+"-"+date;
return dt;
}
/**
*param td:td对象
*param mousein: 是光标移入还是移出
*需在TR中加入以下代码:
* onMouseOut="changeStyle(this,false);" onMouseOver="changeStyle(this,true);"
*/
var theCurrentStyle=null;
function changeStyle(td,mousein){
cells=td.cells;
if(mousein){
theCurrentStyle=new Array();
for(var i=0;i<cells.length;i++){
//记录样式
theCurrentStyle[i]=cells[i].className;
//设置新样式
cells[i].className="border_Change";
}
}else{
for(var i=0;i<theCurrentStyle.length;i++){
//还原样式
cells[i].className =theCurrentStyle[i];
}
}
}
/**
* 得到YYYY-MM-DD hh:mm:ss格式的当前日期前1月的日期
*/
function getOldDateTime() {
var now=new Date();
var year=now.getYear();
var month=now.getMonth();
if(month==0){
month=12;
year=year-1;
}
var date=now.getDate();
var hh=now.getHours();
var mm=now.getMinutes();
var ss=now.getSeconds();
if (month < 10){month = "0" + month;}
if (date < 10){date = "0" + date;}
if (hh < 10){hh = "0" + hh;}
if (mm < 10){mm = "0" + mm;}
if (ss < 10){ss = "0" + ss;}
var dt=year+"-"+month+"-"+date+" "+hh+":"+mm+":"+ss;
return dt;
}
/**
*显示下拉列表树
*/
function showTree(obj){
var o=document.all(obj).style;
var e = window.event.srcElement;
var objExport = eval(arguments[0]);
var t = e.offsetTop, h = e.clientHeight, l = e.offsetLeft, p = e.type;
o.display = "";
var cw = o.clientWidth, ch = o.clientHeight;
var dw = o.clientWidth, dl = document.body.scrollLeft, dt = document.body.scrollTop;
}
/**
*隐藏下拉列表树
*/
function hiddenTree(obj){
document.all(obj).style.display="none";
}
/*
* 检查Sim卡号码必须为20位数字
* 允许sim卡号里面有字母,但是后4位必须是数字
*/
function validateSimCardNum(value) {
//var reg = /^\d{20}$/
//return reg.test(value);
if(value.length==20){
var last=value.substring(16);
var reg = /^\d{4}$/
return reg.test(last);
}else{
return false;
}
}
/*
* 检查键盘输入的是否为0-9之间的数字类型
*/
function checkNumber(){
if (event.keyCode < 48 || event.keyCode > 57)
event.returnValue = false;
}
/**
* 选中的行高亮显示(需要页面导入style.css)
* rowObj 选中的行对象
*/
function clickRowChangeStyle(rowObj){
var tableObj=rowObj.parentElement.parentElement;
for (var i = 0; i < tableObj.rows.length; i++){
if (tableObj.rows(i).className == 'itemOver'){
tableObj.rows(i).className = 'itemOut';
break;
}
}
rowObj.className = 'itemOver';
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -