?? divviewchange.js
字號:
/*
*this file is part of nseer erp
*Copyright (C)2006-2010 Nseer(Beijing) Technology co.LTD/http://www.nseer.com
*
*This program is free software; you can redistribute it and/or
*modify it under the terms of the GNU General Public License
*as published by the Free Software Foundation; either
*version 2 of the License, or (at your option) any later version.
*/
try{
var n_D=new Nseer_DivViewChange('n_D');
document.onmousedown=function (e){n_D.initDrag(e);}
document.onmouseup=function (e){n_D.dragimg(e);}
document.body.onmousemove=function (e){n_D.mouseStyle(e);}
function Nseer_DivViewChange(name){
this.Version = "NSEER ERP V7.0-js1.0";
this.name=name;
this.onmousedown = document.onmousedown;
this.onmousemove = document.onmousemove;
this.onmouseup = document.onmouseup;
this.onselectstart = document.onselectstart;
this.dE=document.getElementById&&!document.all;
this.mouse_tag=0;
this.isdrag=false;
this.oDragObj=null;
this.nseerZindex=0;
this.port_X=0;
this.port_Y=0;
this.port_X1=0;
this.port_Y1=0;
this.left1=0;
this.top1=0;
this.tag=0;
this.min_tag=0;
this.max_tag=0;
this.data=new Array();
this.v=0;
this.db_max_return=0;
this.def=0;
this.nseerDef=0;
this.scrollW=document.body.scrollWidth;
this.detachEvent=function(){//注銷事件
document.onselectstart=this.onselectstart;
}
this.coverSelect=function(div){//注銷事件
var n_iframe=document.createElement('iframe');
n_iframe.src="javascript:false";
n_iframe.style.cssText="position:absolute;visibility:inherit;top:0px;left:0px;width:100%;height:100%;z-index:-1;filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'";
div.appendChild(n_iframe);
}
this.initDrag=function (e){//初始化層方法開始
e=e||window.event;//區分ie和firefox的event
this.mouse_tag=1;
var oDragHandle = this.dE ? e.target : e.srcElement;
var topElement = "HTML";
while (oDragHandle.tagName != topElement && oDragHandle.getAttribute("nseerDef") != "dragAble"&&oDragHandle.getAttribute("nseerDef") != "dragonly"){//在ie和firfox都可以使用getAttribute獲取自定義屬性
oDragHandle = this.dE ? oDragHandle.parentNode : oDragHandle.parentElement;
}
if(oDragHandle.getAttribute("nseerDef")!=null&&oDragHandle.getAttribute("nseerDef")!='undefined'){
if(oDragHandle.getAttribute("nseerDef")=="dragAble"){this.nseerDef=1;}
if(oDragHandle.getAttribute("nseerDef")=="dragonly"){this.nseerDef=2;}
if(this.nseerDef==1||this.nseerDef==2){
this.isdrag = true;
this.oDragObj = oDragHandle;
//*********************************************
//this.oDragObj.style.zIndex=++this.nseerZindex;
this.oDragObj.style.overflow='hidden';
this.port_X1=e.clientX;
this.port_Y1=e.clientY;
var x12=parseInt(this.getStyle(this.oDragObj,"left","left"))+parseInt(this.getStyle(this.oDragObj,"width","width"));
var y12=parseInt(this.getStyle(this.oDragObj,"top","top"))+parseInt(this.getStyle(this.oDragObj,"height","height"));
this.left1=parseInt(this.getStyle(this.oDragObj,"left","left"));
this.top1=parseInt(this.getStyle(this.oDragObj,"top","top"));
this.loadDiv(this.oDragObj,0,e);
//*****************************
if(this.tag==0){
document.onselectstart=this.onselectstart;
}else{
document.onselectstart = function() { return false;};
}
eval('document.onmousemove=function (e){'+this.name+'.moveMouse(e);}');
return false;
}
}
}
this.loadDiv=function (obj,t,e){//點下鼠標時改變鼠標樣式同時置標識位
e=e||window.event;
var nseer_r=obj;
var w = obj.offsetWidth;
var h = obj.offsetHeight;
var x = obj.offsetLeft;
var y = obj.offsetTop;
while(obj=obj.offsetParent){
x += obj.offsetLeft;
y += obj.offsetTop;
}
if(this.nseerDef==1){
if(parseInt(e.clientX)>parseInt(x)&&parseInt(e.clientX)<parseInt(x)+10&&parseInt(e.clientY)<parseInt(y)+h-15&&parseInt(e.clientY)>parseInt(y)+15){//左側邊界
if(t!=0){
nseer_r.style.cursor='e-resize';
}else{
this.tag=8;//左側邊界
}
}else if(parseInt(e.clientX)<parseInt(x)+15&&parseInt(e.clientY)<parseInt(y)+15){
if(t!=0){
nseer_r.style.cursor='nw-resize';//左上角
}else{
this.tag=7;//左上角
}
}else if(parseInt(e.clientX)<parseInt(x)+w&&parseInt(e.clientX)>parseInt(x)+w-10&&parseInt(e.clientY)<parseInt(y)+h-15&&parseInt(e.clientY)>parseInt(y)+15){//右側邊界
if(t!=0){
nseer_r.style.cursor='e-resize';
}else{
this.tag=1;//右側邊界
}
}else if(parseInt(e.clientX)>parseInt(x)+w-5&&parseInt(e.clientY)<parseInt(y)+5){
if(t!=0){
nseer_r.style.cursor='ne-resize';//右上角
}else{
this.tag=5;//右上角
}
}else if(parseInt(e.clientY)<parseInt(y)+5&&parseInt(e.clientX)<parseInt(x)+w-15&&parseInt(e.clientX)>parseInt(x)+15){
if(t!=0){
nseer_r.style.cursor='s-resize';////上側邊界
}else{
this.tag=6;//上側邊界
}
}else if(parseInt(e.clientX)<parseInt(x)+15&&parseInt(e.clientY)>parseInt(y)+h-15){
if(t!=0){
nseer_r.style.cursor='ne-resize';//左下角
}else{
this.tag=9;//左下角
}
}else if(parseInt(e.clientY)<parseInt(y)+h+5&&parseInt(e.clientY)>parseInt(y)+h-5&&parseInt(e.clientX)<parseInt(x)+w-15&&parseInt(e.clientX)>parseInt(x)+15){
if(t!=0){
nseer_r.style.cursor='s-resize';//下邊界
}else{
this.tag=2;//下側邊界
}
}else if(parseInt(e.clientX)>parseInt(x)+w-15&&parseInt(e.clientY)>parseInt(y)+h-15){
if(t!=0){
nseer_r.style.cursor='nw-resize';//右下角
}else{
this.tag=3;//右下角
}
}else if(parseInt(e.clientY)>parseInt(y)+10&&parseInt(e.clientY)<parseInt(y)+33&&parseInt(e.clientX)<parseInt(x)+parseInt(w)-70&&parseInt(e.clientX)>parseInt(x)){
if(t!=0){
nseer_r.style.cursor='move';//移動區域
}else{
this.tag=4;
}
}else{
if(t!=0){
nseer_r.style.cursor='default';//中間區域
}else{
this.tag=0;
}
}
}else if(this.nseerDef==2){
if(parseInt(e.clientY)>parseInt(y)+10&&parseInt(e.clientY)<parseInt(y)+33&&parseInt(e.clientX)<parseInt(x)+parseInt(w)-70&&parseInt(e.clientX)>parseInt(x)){
if(t!=0){
nseer_r.style.cursor='move';//移動區域
}else{
this.tag=4;
}
}else{
if(t!=0){
nseer_r.style.cursor='default';//中間區域
}else{
this.tag=0;
}
}
}
}
this.moveMouse=function (e){//根據鼠標點下時給tag賦的不同值對當前層進行不同操作
if(this.isdrag==true&&this.max_tag==0){
e=e||window.event;
var x12=parseInt(this.getStyle(this.oDragObj,"left","left"))+parseInt(this.getStyle(this.oDragObj,"width","width"));
var y12=parseInt(this.getStyle(this.oDragObj,"top","top"))+parseInt(this.getStyle(this.oDragObj,"height","height"));
if(this.tag==0){
this.port_X=e.clientX;
this.port_Y=e.clientY;
document.body.scrollTop=0;
document.body.scrollLeft=0;
this.left1=parseInt(this.getStyle(this.oDragObj,"left","left"));
this.top1=parseInt(this.getStyle(this.oDragObj,"top","top"));
}
if(this.tag==1){
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_X>parseInt(this.left1)) this.oDragObj.style.width=this.port_X-parseInt(this.left1)+2;
}
if(this.tag==8){
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_X<x12){
this.oDragObj.style.left=this.port_X-2;
this.oDragObj.style.width=x12-this.port_X+2;
}
}
if(this.tag==2){
this.port_X=e.clientX;
this.port_Y=e.clientY;
document.body.scrollTop=0;
document.body.scrollLeft=0;
if(this.port_Y>0&&this.port_Y>parseInt(this.top1)) this.oDragObj.style.height=this.port_Y-parseInt(this.top1);
}
if(this.tag==6){
this.port_X=e.clientX;
this.port_Y=e.clientY;
document.body.scrollTop=0;
document.body.scrollLeft=0;
if(this.port_Y>0&&this.port_Y<y12){
this.oDragObj.style.top=this.port_Y-2;
this.oDragObj.style.height=y12-this.port_Y+2;
}
}
if(this.tag==3){
this.port_X=e.clientX;
this.port_Y=e.clientY;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -