home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn WWW 1999 September
/
www_09_1999.iso
/
info
/
dhtml
/
a9
/
biblioteka.js
< prev
next >
Wrap
Text File
|
1999-07-24
|
7KB
|
189 lines
/********************************************/
/* BIBLIOTEKA Cross-Browser DHTML */
/* wersja 2.1 1999-05-20 */
/********************************************/
/* onFocus Dynamic Web Design */
/* Ania KrΩglewska, Pawe│ Postupalski */
/* mailto:onfocus@webmedia.pl */
/* http://www.onfocus.com.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,nest) {
if(nn4) {
nest ? document.layers[nest].document.layers[ident].visibility = "show" : document.layers[ident].visibility = "show";
} else if(ie4) {
document.all[ident].style.visibility = "visible";
}
}
/**********************/
/* Ukryj blok 'ident' */
/**********************/
function hide(ident,nest) {
if(nn4) {
nest ? document.layers[nest].document.layers[ident].visibility = "hide" : 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,nest) {
if(nn4) {
nest ? document.layers[nest].document.layers[ident].left = x : document.layers[ident].left = x;
nest ? document.layers[nest].document.layers[ident].top = y : 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,nest) {
if(nn4) {
nest ? document.layers[nest].document.layers[ident].left += dx : document.layers[ident].left += dx;
nest ? document.layers[nest].document.layers[ident].top += dy : document.layers[ident].top += dy;
} else if(ie4) {
document.all[ident].style.left = document.all[ident].offsetLeft + dx;
document.all[ident].style.top = document.all[ident].offsetTop + dy;
}
}
/************************************************/
/* Przytnij blok 'ident' do zadanego prostokata */
/* t: top, r: right, b: bottom, l:left */
/************************************************/
function clipTo(ident, t, r, b, l,nest) {
if(nn4) {
if(nest) {
document.layers[nest].document.layers[ident].clip.top = t;
document.layers[nest].document.layers[ident].clip.right = r;
document.layers[nest].document.layers[ident].clip.bottom = b;
document.layers[nest].document.layers[ident].clip.left = l;
} else {
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,nest) {
if(nn4) {
if(nest) {
document.layers[nest].document.layers[ident].clip.top += t;
document.layers[nest].document.layers[ident].clip.right += r;
document.layers[nest].document.layers[ident].clip.bottom += b;
document.layers[nest].document.layers[ident].clip.left += l;
} else {
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,nest) {
if(nn4) {
l = nest ? document.layers[nest].document.layers[ident].left : document.layers[ident].left;
t = nest ? document.layers[nest].document.layers[ident].top : document.layers[ident].top;
} else if(ie4) {
l = document.all[ident].offsetLeft;
t = document.all[ident].offsetTop;
}
}
/******************************************************/
/* Zapisz wysokosc bloku 'ident' do zmienej h: height */
/******************************************************/
function wysokosc(ident,nest) {
if(nn4) {
h = nest ? document.layers[nest].document.layers[ident].document.height : document.layers[ident].document.height;
} else if(ie4) {
h = document.all[ident].scrollHeight;
}
return h;
}
/****************************************/
/* Sprawdz rozmiary okna */
/* 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
}
}
/*************************/
/* Przeladuj cala strone */
/*************************/
function reDo() {
if(nn4) {
if (innerWidth != oknoW+16 || innerHeight != oknoH) {
location.reload();
}
} else location.reload();
}
/*************************/
/* Zmien zawartosc bloku */
/*************************/
function writeTo(ident, tekst, nest) {
if(nn4) {
if(nest) {
document.layers[nest].document.layers[ident].document.open();
document.layers[nest].document.layers[ident].document.write(tekst);
document.layers[nest].document.layers[ident].document.close();
} else {
document.layers[ident].document.open();
document.layers[ident].document.write(tekst);
document.layers[ident].document.close();
}
} else if(ie4) {
document.all[ident].innerHTML = tekst;
}
}