📄 libcrossbrowser.js
字号:
div.style.pixelTop =div.offsetTop +top;
return;
}
if(_dom==1){
div.style.pixelLeft+=left;
div.style.pixelTop +=top;
return;
}
if(_dom==3){
div.moveBy(left,top);
return;
}
}
function scrollExlHItTo(exdiv,x){
if(_dom==4){
frames[exdiv.id].scrollTo(x,frames[exdiv.id].scrollY);
return;
}
if(_dom==2 || _dom==1){
frames(exdiv.id+'_if').scrollTo(x,frames(exdiv.id+'_if').document.body.scrollTop);
return;
}
if(_dom==3){
var dx=x-exdiv.clip.left, ch=exdiv.clip.width;
exdiv.left-=dx;
exdiv.clip.left=x; exdiv.clip.width=ch;
return;
}
return;
}
function scrollExlVItTo(exdiv,y){
if(_dom==4){
frames[exdiv.id].scrollTo(frames[exdiv.id].scrollX,y);
return;
}
if(_dom==2 || _dom==1){
frames(exdiv.id+'_if').scrollTo(frames(exdiv.id+'_if').document.body.scrollLeft,y);
return;
}
if(_dom==3){
var dy=y-exdiv.clip.top, ch=exdiv.clip.height;
exdiv.top-=dy;
exdiv.clip.top=y; exdiv.clip.height=ch;
return;
}
return;
}
function initDivSize(div){
if(_dom==4){
// getComputedStyle is buggy in NN6, and wrong in Mozilla 0.8/9
//
// var style=document.defaultView.getComputedStyle(div,null);
// div.style.width =style.getPropertyValue('width' );
// div.style.height=style.getPropertyValue('height');
//
div.style.width =div.offsetWidth +'px';
div.style.height=div.offsetHeight+'px';
//
// need border-width=0px, margin-width:0px
}
else if(_dom==2 || _dom==1){
div.style.pixelWidth =div.offsetWidth;
div.style.pixelHeight=div.offsetHeight;
}
return div;
}
function getDivWidth (div){
if(_dom==4 || _dom==2) return div.offsetWidth;
if(_dom==1) return div.style.pixelWidth;
if(_dom==3) return div.clip.width;
return 0;
}
function getDivHeight(div){
if(_dom==4 || _dom==2) return div.offsetHeight;
if(_dom==1) return div.style.pixelHeight;
if(_dom==3) return div.clip.height;
return 0;
}
function resizeDivTo(div,width,height){
if(_dom==4){
div.style.width =width +'px';
div.style.height=height+'px';
return;
}
if(_dom==2 || _dom==1){
div.style.pixelWidth =width;
div.style.pixelHeight=height;
return;
}
if(_dom==3){
div.resizeTo(width,height);
return;
}
}
function resizeDivBy(div,width,height){
if(_dom==4){
div.style.width =(div.offsetWidth +width )+'px';
div.style.height=(div.offsetHeight+height)+'px';
return;
}
if(_dom==2){
div.style.pixelWidth =div.offsetWidth +width;
div.style.pixelHeight=div.offsetHeight+height;
return;
}
if(_dom==1){
div.style.pixelWidth +=width;
div.style.pixelHeight+=height;
return;
}
if(_dom==3){
div.resizeBy(width,height);
return;
}
}
function getExlWidth (exdiv){
if(_dom==4)
// NN6 is buggy( same exdiv.offsetWidth )
return exdiv.contentDocument.body.offsetWidth;
if(_dom==2 || _dom==1)
return _mac?frames(exdiv.id+'_if').document.body.offsetWidth
:frames(exdiv.id+'_if').document.body.scrollWidth;
if(_dom==3)
return exdiv.document.width;
return 0;
}
function getExlHeight(exdiv){
if(_dom==4)
return exdiv.contentDocument.body.offsetHeight;
if(_dom==2 || _dom==1)
return _mac?frames(exdiv.id+'_if').document.body.offsetHeight
:frames(exdiv.id+'_if').document.body.scrollHeight;
if(_dom==3)
return exdiv.document.height;
return 0;
}
function setDivVisibility(div,visible){
if(_dom==4 || _dom==2 || _dom==1){
div.style.visibility=(visible)?'inherit':'hidden';
return;
}
if(_dom==3){
div.visibility =(visible)?'inherit':'hide';
return;
}
}
function setDivVisibilities(divs,visible){
if(_dom==4 || _dom==2 || _dom==1){
for(var i=0; i<divs.length; i++)
divs[i].style.visibility=(visible)?'inherit':'hidden';
}
if(_dom==3){
for(var i=0; i<divs.length; i++)
divs[i].visibility =(visible)?'inherit':'hide';
}
return divs;
}
function setDivClip(div,top,right,bottom,left){
if(_dom==4 || _dom==2 || _dom==1){
div.style.clip='rect('+top+'px '+right+'px '+bottom+'px '+left+'px)';
return;
}
if(_dom==3){
div.clip.top =top; div.clip.right=right;
div.clip.bottom=bottom;div.clip.left =left;
return;
}
}
function writeDivHTML(div,op,cl){
var s='';
for(var i=3; i<arguments.length; i++) s+=arguments[i];
if(_dom==4){
if(op){ while(div.hasChildNodes()) div.removeChild(div.lastChild); }
var range=document.createRange();
range.selectNodeContents(div);
range.collapse(true);
var cf=range.createContextualFragment(s);
div.appendChild(cf);
return;
}
if(_dom==2 || _dom==1){
if(op) div.innerHTML='';
if(_mac&&!_ie512) div.innerHTML+=s;
else div.insertAdjacentHTML('BeforeEnd',s);
return;
}
if(_dom==3){
if(op) div.document.open('text/html','replace');
div.document.write(s);
if(cl) div.document.close();
return;
}
}
function setDivBackgroundColor(div,color){
if(color==null) color='transparent';
if(_dom==3) div.bgColor=color;
else div.style.backgroundColor=color;
}
function setDivBackgroundImage(div,url){
if(_dom==3) div.background.src=url?url:null;
else div.style.backgroundImage=url?('url('+url+')'):'none';
}
function setDivZIndex(div,order){
if(_dom==4 || _dom==2 || _dom==1){
div.style.zIndex=order;
return;
}
if(_dom==3){
div.zIndex =order;
return;
}
}
function setDivStyleAttribute(div,nm,value){
if(_dom!=0 && _dom!=3) eval('div.style.'+nm+'=value');
return div;
}
function changeExlURL(exdiv,url){
if(_dom==4){
exdiv.setAttribute('src',url);
return;
}
if(_dom==2 || _dom==1){
frames(exdiv.id+'_if').location.replace(url);
return;
}
if(_dom==3){
exdiv.load(url,exdiv.clip.width);
return;
}
return;
}
function getLeftFromEvent(e){
if(_dom==4) return e.clientX+window.scrollX;
if(_dom==2||_dom==1) return document.body.scrollLeft+window.event.clientX;
if(_dom==3) return e.pageX;
return 0;
}
function getTopFromEvent(e){
if(_dom==4) return e.clientY+window.scrollY;
if(_dom==2||_dom==1) return document.body.scrollTop+window.event.clientY;
if(_dom==3) return e.pageY;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -