All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.scripts.common.Common.js Maven / Gradle / Ivy

There is a newer version: 0.41.3
Show newest version
function portableEvent(e){
   if(!e){
     return window.event;
   }else{
     return e;
   }
}

function quickSearch(form, actionMethod, formElementName, formElementValue, formTarget, functionName, isMutil) {
    if (!isMutil) {
        for(var i =0; i < form.length; i ++) {
        	form.elements[i].value = "";
        }
    }

    form.action = actionMethod;
    form[formElementName].value = formElementValue ? formElementValue : "";
    if (null != formTarget) {
        form.target = formTarget;
    }
    fObject = eval(functionName);
    fObject();
}

/**
 * 选择复选框中的值,返回一个数组
 * auth:zhouqi
 *
 */
function selectedCheckBoxContents(cb_name) {
	try {
		var cb = document.getElementsByName(cb_name);
		var yCount = selectedCheckBoxLength(cb_name);
		
		var yContent = new Array(yCount);
		for (var i = 0; i < yCount; i++) {
			for (var j = i; j < cb.length; j ++) {
				if (cb[j].checked) {
					yContent[i] = cb[j].value;
					break;
				}
			}
		}
		return yContent;
	} catch (e) {
		return null;
	}
}

function selectedCheckBoxLength(cb_name) {
	
	try {
		var cb = document.getElementsByName(cb_name);
		var yCount = 0;
		for (var i = 0; i < cb.length; i++) {
			if (cb[i].checked) {
				yCount ++;
			}
		}
		return yCount;
	} catch (e) {
		return 0;
	}
}

 /**
  *  获得正在发生的事件
  *  同时兼容ie和ff的写法
  */
function getEvent()
{  
    if(document.all)   return window.event;
    func=getEvent.caller;
    while(func!=null){
        var arg0=func.arguments[0];
        if(arg0)
        {
          if((arg0.constructor==Event || arg0.constructor ==MouseEvent) || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation))
          {  
          return arg0;
          }
        }
        func=func.caller;
    }
    return null;
}
/**
 *获得事件背后的元素
 */
function getEventTarget(e){
  e=portableEvent(e);
  if(document.all){
     return e.srcElement;
  }else{
     return e.target;
  }
}
/*
function MakeFull(){
	var args = MakeFull.arguments;
	var resize_able = args[1];
	if (null == resize_able) {
		resize_able = "no";
	}
	var url = args[0];
	var name = "";
	if (args.length > 1){
		name = args[1];
	}
	var closeSelf = false;
	if (args.length > 2){
		closeSelf = args[2];
	}

    var width=1024;
    var height=735;
    if (screen.width == 800){
        width = 800;
        height = 570;
    }

    var win = window.open(url,name,'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=' + resize_able + ',scrollbars=yes');
	win.moveTo(0,0);
	win.resizeTo(width,height);
    win.focus();

	if (closeSelf)
		CloseWin();
}
*/
function CloseWin(){
    var ua=navigator.userAgent;
    var ie=navigator.appName=="Microsoft Internet Explorer"?true:false;
    if(ie){
        var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))));
        if(IEversion< 5.5){
            var str  = '';
            str += '';
            document.body.insertAdjacentHTML("beforeEnd", str);
            document.all.noTipClose.Click();
        } else{
            window.opener =null;
            window.close();
        }
    } else {
        window.close();
    }
}


function turnit(name, index, count){
	var currentTree = eval(name+index);
	
	if (currentTree.style.display=="none") {
		for (var i=1; i<=count; i++) {
			try{   
				var tree = eval(name+i);
				tree.style.display="none";
			} catch(e){
			}
		}
		currentTree.style.display="block";
	} else {
		currentTree.style.display="none"; 
	}
}

function MM_changeSearchBarStyle(bar) { 
    if ((obj=MM_findObj(bar))!=null) { 
  		if (obj.style.visibility == 'hidden'){
  		    obj.style.visibility = 'visible';
  		    obj.style.display = 'block';
  		} else {
  		    obj.style.visibility = 'hidden';
  		    obj.style.display = 'none';
  		}
    }
}

function MM_showHideLayers() { //v6.0
  showHiden(MM_showHideLayers.arguments);
}

function showHiden(args)
{
  var i,p,v,obj;
  for (i=0; i<(args.length-2); i+=3){
  	if ((obj=MM_findObj(args[i]))!=null) { 
  		v=args[i+2];
    	if (obj.style) { 
    		obj=obj.style; 
    		v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
    	}
    	obj.visibility=v;
    }
  } 
}

function highlightButton(s) {
	if ("INPUT"==event.srcElement.tagName)
		event.srcElement.className=s;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i 1){
		name = popupCommonWindow.arguments[1];
	}

    var width = 500;
    var height = 600;
    if (popupCommonWindow.arguments.length > 2)
       width = popupCommonWindow.arguments[2];
    if (popupCommonWindow.arguments.length > 3)
       height = popupCommonWindow.arguments[3];
    
    var win = window.open(url, name, 'scrollbars=yes,width='+width+',height='+height+',status=no,resizable=yes,depended=yes');
	win.self.resizeTo(width, height);
	win.self.moveTo((screen.width-width)/2, (screen.height-height)/2);
	win.self.focus();
}

function popupCommonSelector(url){
	var name = '';
	if (popupCommonSelector.arguments.length > 1)
	{
		name = popupCommonSelector.arguments[1];
	}
	popupCommonWindow(url, name);
}

function popupMiniCommonSelector(){
    var args = popupMiniCommonSelector.arguments;
    
	var url = args[0];
	var top = 0;
	var left = 0;
	if (args.length>1){top=args[1];}
	if (args.length>2){left=args[2];}
	
    var selector = 0;
    if (selector&&(selector.closed)){
        selector.close();
    }    
	var selector= window.open(url, 'selector', 'scrollbars=yes,status=yes,resizable=yes,depended=yes,width=1,height=1,left=1000,top=1000');		
	selector.self.moveTo(top,left);
	selector.self.resizeTo(430,735);
    
}

function disableButton(){
    var args = disableButton.arguments;
    var formObjName = args[0];
    if (args.length >1){
       for (var i=1; i=0; i--){   
		if (options[i].selected){  
			options[i] = null;
		}
	}
}

function moveSelectedOption(srcSelect, destSelect){
	for (var i=0; i4){
       if (args[4]=="join"){
          tempIds = joinIds(document.all[idsTarget].value, ids);
          tempDescriptions = joinNames(document.all[descriptionsTarget].value, descriptions);
       }
       if (args[4]=="reset"){
          tempIds = "";
          tempDescriptions = "";
       }
   } else {
       tempIds = ids;
       tempDescriptions = descriptions;
   }
   
   document.all[idsTarget].value = tempIds;
   document.all[descriptionsTarget].value = tempDescriptions;
}

/*?????????id????????????????????????*/
function joinIds(targetIds, joinIds){
   if (targetIds != ""){
       var tempIds = joinIds.split(",");
       var currentIds = "," + targetIds + ",";
       
       for (var i=0; i0)){
              currentIds = currentIds + tempIds[i] + ",";
          }
       }
       
       var ids = currentIds.split(",");
       var finalIds = ",";
       for (var i=0; i0)){
              currentNames = currentNames + tempNames[i] + ",";
          }
       }
       
       var names = currentNames.split(",");
       var finalNames = ",";
       for (var i=0; i[internet选项..]->[安全]选项卡中选择[自定义级别..]按钮,之后将其中activeX部分的设置改为'启用'.");
	    return;
	  }
  }

function isEmpty(obj) {
    return "undefined" == typeof(obj) || null == obj || "" == obj;
}

function isNotEmpty(obj) {
    return !isEmpty(obj);
}

function doClick(name) {
    if(document.all) {
        document.getElementById(name).click();
    } else {
        var evt = document.createEvent("MouseEvents");
        evt.initEvent("click", true, true);
        document.getElementById(name).dispatchEvent(evt);
    }
}

function getContextPath(){
       return self.location.pathname.substring(0,self.location.pathname.substring(1).indexOf('/')+1);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy