home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn WWW 1999 September
/
www_09_1999.iso
/
info
/
dhtml
/
a4_txt
/
biblioteka.txt
next >
Wrap
Text File
|
1999-02-21
|
5KB
|
150 lines
/********************************************/
/* BIBLIOTEKA Cross-Browser DHTML */
/* wersja 1.0 1999-02-19 */
/********************************************/
/* onFocus Dynamic Web Design */
/* http://www.webmedia.pl/onfocus/ */
/* mailto:onfocus@webmedia.pl */
/********************************************/
/* Ania Kreglewska: akreglew@elka.pw.edu.pl */
/* Pawel Postupalski: pawelek@webmedia.pl */
/********************************************/
/* Ta biblioteka moze byc wykorzystywana */
/* bez zadnych ograniczen pod warunkiem */
/* zachowania tej informacji. */
/********************************************/
/*************************/
/* Detekcja przegladarki */
/*************************/
nn4 = (document.layers) ? true:false;
ie4 = (document.all) ? true:false;
/**********************/
/* Pokaz blok 'ident' */
/**********************/
function show(ident) {
if(nn4) {
document.layers[ident].visibility = "show";
} else if(ie4) {
document.all[ident].style.visibility = "visible";
}
}
/**********************/
/* Ukryj blok 'ident' */
/**********************/
function hide(ident) {
if(nn4) {
document.layers[ident].visibility = "hide";
} else if(ie4) {
document.all[ident].style.visibility = "hidden";
}
}
/****************************************/
/* Przesun blok 'ident' do punktu (x,y) */
/****************************************/
function moveTo(ident,x,y) {
if(nn4) {
document.layers[ident].left = x;
document.layers[ident].top = y;
} else if(ie4) {
document.all[ident].style.left = x;
document.all[ident].style.top = y;
}
}
/*****************************************/
/* Przesun blok 'ident' o wektor [dx,dy] */
/*****************************************/
function moveBy(ident,dx,dy) {
if(nn4) {
document.layers[ident].left = document.layers[ident].left + dx;
document.layers[ident].top = document.layers[ident].top + dy;
} else if(ie4) {
document.all[ident].style.left = document.all[ident].style.pixelLeft + dx;
document.all[ident].style.top = document.all[ident].style.pixelTop + dy;
}
}
/************************************************/
/* Przytnij blok 'ident' do zadanego prostokata */
/* t: top, r: right, b: bottom, l:left */
/************************************************/
function clipTo(ident, t, r, b, l) {
if(nn4) {
document.layers[ident].clip.top = t;
document.layers[ident].clip.right = r;
document.layers[ident].clip.bottom = b;
document.layers[ident].clip.left = l;
} else if(ie4) {
document.all[ident].style.clip =
"rect(" + t + " " + r + " " + b + " " + l + ")";
}
}
/****************************************************/
/* Zmien przyciecie bloku 'ident' o zadane wartosci */
/* t: top, r: right, b: bottom, l: left */
/****************************************************/
function clipBy(ident, t, r, b, l) {
if(nn4) {
document.layers[ident].clip.top += t;
document.layers[ident].clip.right += r;
document.layers[ident].clip.bottom += b;
document.layers[ident].clip.left += l;
} else if(ie4) {
ie_clip = document.all[ident].style.clip;
ie_clip = ie_clip.substring(5, ie_clip.length-1);
ie_clip_wart = ie_clip.split("px");
t += parseInt(ie_clip_wart [0]);
r += parseInt(ie_clip_wart [1]);
b += parseInt(ie_clip_wart [2]);
l += parseInt(ie_clip_wart [3]);
document.all[ident].style.clip =
"rect(" + t + "px " + r + "px " + b + "px " + l + "px)";
}
}
/***********************************************************/
/* Zapisz pozycje bloku 'ident' do zmiennych l:left, t:top */
/***********************************************************/
function pozycja(ident) {
if(nn4) {
l = document.layers[ident].left;
t = document.layers[ident].top;
} else if(ie4) {
l = document.all[ident].style.pixelLeft;
t = document.all[ident].style.pixelTop;
}
}
/******************************************************/
/* Zapisz wysokosc bloku 'ident' do zmienej h: height */
/******************************************************/
function wysokosc(ident) {
if(nn4) {
h = document.layers[ident].document.height;
} else if(ie4) {
h = document.all[ident].scrollHeight;
}
return h;
}
/****************************************/
/* Sprawdz rozmiary okna. Zapisuje: */
/* oknoW: dostepna szerokosc */
/* oknoH: dostepna wysokosc */
/****************************************/
function okno(){
if(nn4){
oknoW=window.innerWidth-16;
oknoH=window.innerHeight
}else if(ie4){
oknoW=document.body.offsetWidth-20;
oknoH=document.body.offsetHeight
}
}