home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 December
/
PCWorld_2002-12_cd.bin
/
Novinky
/
interval
/
img
/
102
/
alert.js
next >
Wrap
Text File
|
2002-10-30
|
2KB
|
86 lines
IE= null;
NS= null;
ua = navigator.appName.toLowerCase();
if(ua.indexOf('explorer')>-1 && document.getElementById && document.childNodes) {IE=true;}
if(ua.indexOf('netscape')>-1 && document.getElementById && document.childNodes) {NS=true;}
// Preload image
q = new Image();
q.src = 'http://albert.osu.cz/~xksuyn/cor/4/podklady/kusyn/tm.gif';
function test_prohlizec()
{
if(!IE && !NS)
{
self.location = "javascript: alert('Chyba v dokumentu "+self.location+" .Prohlizec nepodporuje metody standardu W3C DOM a neni mozno dokument spravne zobrazit.')";
}
}
function posunY()
{
if(IE) return document.body.scrollTop;
if(NS) return window.pageYOffset;
}
function posunX()
{
if(IE) return document.body.scrollLeft;
if(NS) return window.pageXOffset;
}
function ziskej_velikost()
{
if(IE)
{
sirka_okna = document.body.clientWidth;
vyska_okna = document.body.clientHeight;
}
if(NS)
{
sirka_okna = innerWidth -17;
vyska_okna = innerHeight;
}
}
function hlaska(hlaska)
{
test_prohlizec();
ziskej_velikost();
// Vytvoreni pozadi a nastaveni vlastnosti
bg = document.createElement('div');
bg.style.position = "absolute";
bg.style.top = posunY() + "px";
bg.style.left = posunX() + "px";
bg.style.width = (sirka_okna)+ "px"
bg.style.height = (vyska_okna)+ "px";
bg.style.zIndex = "99";
bg.style.backgroundImage = "url('http://albert.osu.cz/~xksuyn/cor/4/podklady/kusyn/tm.gif')";
// Pozor je nutno zadat cele url obrazku, ranne verze mozilly a netscape jinak obrazek nezobrazi!
document.body.appendChild(bg);
// Vytvoreni hlasky
hl = document.createElement('div');
hl.style.position = "absolute";
hl.style.top = ((vyska_okna)/2 - 50) + posunY() + "px";
hl.style.left = ((sirka_okna)/2 - 100) + posunX() + "px";
hl.style.width = "200px";
hl.style.zIndex = "100";
hl.style.backgroundColor = "white";
hl.style.border = "solid 1px black"
hl.style.textAlign = "center";
hl.innerHTML += '<br />'+hlaska+'<br /><br /><input value=" OK " type=button onClick="Javascript: bg.parentNode.removeChild(bg); hl.parentNode.removeChild(hl);"><br /><br />';
document.body.appendChild(hl);
}