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

📄 divviewchange.js

📁 这是以前做的一个项目 内有项目分析 时序图也有 是基于ssh框架的一个统计系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
				document.body.scrollTop=0;
				document.body.scrollLeft=0;
				if(this.port_X>0&&this.port_Y>0&&this.port_X>parseInt(this.left1)&&this.port_Y>parseInt(this.top1)){
					this.oDragObj.style.width=this.port_X-parseInt(this.left1);
					this.oDragObj.style.height=this.port_Y-parseInt(this.top1);
				}
			}
			if(this.tag==5){
				this.port_X=e.clientX;
				this.port_Y=e.clientY;
				document.body.scrollTop=0;
				document.body.scrollLeft=0;
				if(this.port_X>0&&this.port_Y>0&&this.port_X>parseInt(this.left1)&&this.port_Y<y12){
					this.oDragObj.style.top=this.port_Y-2;
					this.oDragObj.style.width=this.port_X-parseInt(this.left1)+2;
					this.oDragObj.style.height=y12-this.port_Y+2;
				}
			}
			if(this.tag==7){
				this.port_X=e.clientX;
				this.port_Y=e.clientY;
				document.body.scrollTop=0;
				document.body.scrollLeft=0;
				if(this.port_X>0&&this.port_Y>0&&this.port_X<x12&&this.port_Y<y12){
					this.oDragObj.style.top=this.port_Y-2;
					this.oDragObj.style.left=this.port_X-2;
					this.oDragObj.style.width=x12-this.port_X+2;
					this.oDragObj.style.height=y12-this.port_Y+2;
				}
			}
			if(this.tag==9){
				this.port_X=e.clientX;
				this.port_Y=e.clientY;
				document.body.scrollTop=0;
				document.body.scrollLeft=0;
				if(this.port_X>0&&this.port_Y>0&&this.port_Y>parseInt(this.top1)&&this.port_X<x12){
					this.oDragObj.style.left=this.port_X-2;
					this.oDragObj.style.width=x12-this.port_X+2;
					this.oDragObj.style.height=this.port_Y-this.top1+2;
				}
			}
			if(this.tag==4){
				this.port_X=e.clientX;
				this.port_Y=e.clientY;
				document.body.scrollTop=0;
				document.body.scrollLeft=0;
				this.oDragObj.style.left=(this.left1+this.port_X-this.port_X1)<0?"0px":this.left1+this.port_X-this.port_X1+"px";
				this.oDragObj.style.top=(this.top1+this.port_Y-this.port_Y1)<0?"0px":this.top1+this.port_Y-this.port_Y1+'px';
				if(parseInt(this.oDragObj.style.left)+parseInt(this.getStyle(this.oDragObj,"width","width"))>document.body.clientWidth){
					this.oDragObj.style.left=document.body.clientWidth-parseInt(this.getStyle(this.oDragObj,"width","width"));
				}
				if((document.body.clientHeight-parseInt(this.getStyle(this.oDragObj,"height","height")))<parseInt(this.getStyle(this.oDragObj,"top","top"))){
					this.oDragObj.style.top=document.body.clientHeight-parseInt(this.getStyle(this.oDragObj,"height","height"));
				}
			}
			return false;
		}
	} 
	this.getStyle=function (elem,IE,FF){//获取定义在css文件里的样式属性值
		return navigator.appName=="Microsoft Internet Explorer"?elem.currentStyle[IE]:document.defaultView.getComputedStyle(elem, "").getPropertyValue(FF);
	}
	this.dragimg=function (e){//抬起鼠标时
		this.mouse_tag=0;
		if(this.oDragObj!=null){
			//this.oDragObj.style.zIndex=++this.nseerZindex;
		}
		this.isdrag=false;
		this.detachEvent();
	}
	this.mouseStyle=function (e){//在body内move鼠标时更改鼠标样式
		e=e||window.event;
		if(this.mouse_tag==0){
			var x12;
			var y12;
			var port_X;
			var port_Y;
			var oDragHandle1 = this.dE?e.target : event.srcElement;
			var topElement = "HTML";
			while (oDragHandle1.tagName != topElement && oDragHandle1.getAttribute("nseerDef") != "dragAble"&&oDragHandle1.getAttribute("nseerDef") != "dragonly") {
				oDragHandle1 = this.dE?oDragHandle1.parentNode:oDragHandle1.parentElement;
			}
			if(oDragHandle1.getAttribute("nseerDef")!=null&&oDragHandle1.getAttribute("nseerDef")!='undefined'){
			if(oDragHandle1.getAttribute("nseerDef")=="dragAble"){this.nseerDef=1;}
			if(oDragHandle1.getAttribute("nseerDef")=="dragonly"){this.nseerDef=2;}
			if(this.nseerDef==1||this.nseerDef==2){
				eval('oDragHandle1.ondblclick=function(e){'+this.name+'.doubleClickDiv(e);}');
				x12=parseInt(this.getStyle(oDragHandle1,"left","left"))+parseInt(this.getStyle(oDragHandle1,"width","width"));
				y12=parseInt(this.getStyle(oDragHandle1,"top","top"))+parseInt(this.getStyle(oDragHandle1,"height","height"));
				port_X=e.clientX;
				port_Y=e.clientY;
				this.top1=parseInt(this.getStyle(oDragHandle1,"top","top"));
				this.left1=parseInt(this.getStyle(oDragHandle1,"left","left"));
			}
			}
			this.loadDiv(oDragHandle1,1,e);
		}
	}
	this.mmcMouseStyle=function(obj){//当鼠标放在放大缩小等按钮时,改变样式
		obj.style.cursor='hand';
	}
	this.maxDiv=function (){
		if(this.nseerDef==2){return false;}
		this.max_tag=1;
		if(this.min_tag==0){//得初始时的坐标,宽度,高度.
			var t=this.getStyle(this.oDragObj,"top","top");
			var l=this.getStyle(this.oDragObj,"left","left");
			var w=this.getStyle(this.oDragObj,"width","width");
			var h=this.getStyle(this.oDragObj,"height","height");
			var string_data=t+'#'+l+'#'+w+'#'+h;
			this.def=this.v;
			this.data[this.v]=string_data;
			this.v++;
		}
		this.oDragObj.style.top='0px';//最大化
		this.oDragObj.style.left='0px';
		this.oDragObj.style.width=document.body.clientWidth;
		this.oDragObj.style.height=document.body.clientHeight;
		//********************************************************
		var oDragObj_childNodes=this.oDragObj.getElementsByTagName('div');
		for(var i=0;i<oDragObj_childNodes.length;i++){
			if(oDragObj_childNodes[i].id=='expand'){
				oDragObj_childNodes[i].style.backgroundImage='url(/erp/javascript/include/div/images/return.gif)';
				eval('oDragObj_childNodes[i].onclick=function(){'+this.name+'.returnDiv()}');
			}
			if(oDragObj_childNodes[i].id=='collapse'){
				oDragObj_childNodes[i].style.backgroundImage='url(/erp/javascript/include/div/images/collapse.gif)';
				eval('oDragObj_childNodes[i].onclick=function(){'+this.name+'.minDiv();}');
			}
		}
	}
	this.returnDiv=function (){
		this.min_tag=0;
		this.max_tag=0;
		var s=this.def;
		//alert(this.data);
		var da=this.data[s].split('#');
		this.oDragObj.style.top=da[0];
		this.oDragObj.style.left=da[1];
		this.oDragObj.style.width=da[2];
		this.oDragObj.style.height=da[3];
		var oDragObj_childNodes=this.oDragObj.getElementsByTagName('div');
		for(var i=0;i<oDragObj_childNodes.length;i++){
			if(oDragObj_childNodes[i].id=='expand'){
				oDragObj_childNodes[i].style.backgroundImage='url(/erp/javascript/include/div/images/expand.gif)';
				eval('oDragObj_childNodes[i].onclick=function(){'+this.name+'.maxDiv();}');
			}
		}
	}
	this.returnDiv1=function (){//点击最小化后点击还原时执行
		this.min_tag=0;
		this.max_tag=0;
		var s=this.def;
		var da=this.data[s].split('#');
		this.oDragObj.style.top=da[0];
		this.oDragObj.style.left=da[1];
		this.oDragObj.style.width=da[2];
		this.oDragObj.style.height=da[3];
		var oDragObj_childNodes=this.oDragObj.getElementsByTagName('div');
		for(var i=0;i<oDragObj_childNodes.length;i++){
			if(oDragObj_childNodes[i].id=='collapse'){
				oDragObj_childNodes[i].style.backgroundImage='url(/erp/javascript/include/div/images/collapse.gif)';
				eval('oDragObj_childNodes[i].onclick=function(){'+this.name+'.minDiv();}');
			}
		}
	}
	this.minDiv=function (s){
		this.min_tag=1;
		var ss=s||40;
		if(this.max_tag==0){
			var t=this.getStyle(this.oDragObj,"top","top");
			var l=this.getStyle(this.oDragObj,"left","left");
			var w=this.getStyle(this.oDragObj,"width","width");
			var h=this.getStyle(this.oDragObj,"height","height");
			var string_data=t+'#'+l+'#'+w+'#'+h;
			this.def=this.v;
			this.data[this.v]=string_data;
			this.v++;
		}
		this.oDragObj.style.height=ss+'px';
		this.oDragObj.style.overflow='hidden';
		this.oDragObj.style.width=ss*10+'px';
		var oDragObj_childNodes=this.oDragObj.getElementsByTagName('div');
		for(var i=0;i<oDragObj_childNodes.length;i++){
			if(oDragObj_childNodes[i].id=='collapse'){
				oDragObj_childNodes[i].style.backgroundImage='url(/erp/javascript/include/div/images/return.gif)';
				eval('oDragObj_childNodes[i].onclick=function(){'+this.name+'.returnDiv1();}');
			}
			if(oDragObj_childNodes[i].id=='expand'){
				oDragObj_childNodes[i].style.backgroundImage='url(/erp/javascript/include/div/images/expand.gif)';
				eval('oDragObj_childNodes[i].onclick=function(){'+this.name+'.maxDiv();}');
			}
		}
	}
	this.closeDiv=function (closeType){//关闭该层
	unloadCover(this.oDragObj.id);
		if(closeType=='remove'){
			try{
			if (window.ActiveXObject){document.body.removeChild(document.getElementById(this.oDragObj.id));}else{this.oDragObj.oparentNode.removeChild(document.getElementById(this.oDragObj.id));}
			}catch(e){}
		}
		else if(closeType=='hidden'){this.oDragObj.style.display='none';}
		else if(closeType=='reconfirm'){}
	}
	this.doubleClickDiv=function (e){//双击层顶部特殊区域最大化和最小化
		e=e||window.event;
		var t=parseInt(this.getStyle(this.oDragObj,"top","top"));
		var l=parseInt(this.getStyle(this.oDragObj,"left","left"));
		var w=parseInt(this.getStyle(this.oDragObj,"width","width"));
		var h=parseInt(this.getStyle(this.oDragObj,"height","height"));
		var port_X1=e.clientX;
		var port_Y1=e.clientY;
		var x12=l+w;
		if(port_Y1>(t+5)&&port_Y1<(t+25)&&port_X1>(l+5)&&port_X1<(x12-5)){
			if(this.db_max_return==0){
				this.maxDiv();
				this.db_max_return=1;
			}else if(this.db_max_return==1){
				this.returnDiv();
				this.db_max_return=0;
			}
		}
	}
 }
 var _d=_t.length-5;
 }catch(e){}

⌨️ 快捷键说明

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