Programalama > JAVA SCRIPT

Etiketler: arka, planda, yildizlar

Ort. 0
Puan ver:
<!-- 

<div style="position:relative"> - Rest of page - </div>

--> 

<script language="JavaScript">

<!-- 3D Space Trip Script by kurt.grigg@virgin.net

Nstars=15;

Y=new Array();

X=new Array();

Sstars=new Array();

Dstars=new Array();

Brwsr=(document.layers)?1:0;

iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;

iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;

offvis=(document.layers)?'hide':'hidden';

onvis=(document.layers)?'show':'visible';

for (i=0; i < Nstars;i++) 

 {                                                                

 Y[i]=iH/2;

 X[i]=iW/2;

 Dstars[i]=Math.round(Math.random()*360);

 Sstars[i]=Math.round(Math.random()*5+2);

 }

if (Brwsr){

for (i=0; i < Nstars;i++)

document.write("<LAYER NAME='nstar"+i+"' TOP=0 LEFT=0 BGCOLOR=#aaaaaa WIDTH=1 HEIGHT=1></LAYER>");

}

else{

document.write('<div id="Outer" style="position:absolute"><div style="position:relative">');

for (i=0; i < Nstars;i++)

{document.write('<div id="istar" style="position:absolute;width:1px;height:1px;background:#aaaaaa;font-size:1px"></div>')}

document.write('</div></div>');

}

function fly(){

H=(document.layers)?window.innerHeight:window.document.body.clientHeight;

W=(document.layers)?window.innerWidth:window.document.body.clientWidth;

hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;

wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;

for (i=0; i < Nstars;i++){

var layer=(document.layers)?document.layers["nstar"+i]:istar[i].style;   

Sstars[i]+=0.3;

//Dstars[i]+=2; //Can spin using this!!

Y[i]+=Math.round(Sstars[i]*Math.sin(Dstars[i]*Math.PI/180));

X[i]+=Math.round(Sstars[i]*Math.cos(Dstars[i]*Math.PI/180));

if ((Y[i] > H) || (Y[i] < 0 ) || (X[i] > W) || (X[i] < 0))

 {

 Y[i]=H/2;

 X[i]=W/2;

 Dstars[i]=Math.round(Math.random()*360);

 Sstars[i]=Math.round(Math.random()*5+2);

 }

layer.top=Y[i]+hscrll;

layer.left=X[i]+wscrll; 

if ((X[i] < W/2-W/8) || (X[i] > W/2+W/8) || (Y[i] < H/2-H/8) || (Y[i] > H/2+H/8)) 

 {

 if (Brwsr) {layer.bgColor='cccccc';layer.clip.height=2;layer.clip.width=2}

 else {layer.background='cccccc';layer.height=2;layer.width=2;layer.fontSize=2}

 }

if ((X[i] < W/2-W/6) || (X[i] > W/2+W/6) || (Y[i] < H/2-H/6) || (Y[i] > H/2+H/6)) 

 {

 if (Brwsr) layer.bgColor='dddddd';

 else layer.background='dddddd';

 }

if ((X[i] < W/2-W/2.5) || (X[i] > W/2+W/2.5) || (Y[i] < H/2-H/2.5) || (Y[i] > H/2+H/2.5)) 

 {

 if (Brwsr){layer.bgColor='ffffff';layer.clip.height=3;layer.clip.width=3}

 else {layer.background='ffffff';layer.height=3;layer.width=3;layer.fontSize=3}

 }

if ((X[i] < (W/2)-10 ) || (X[i] > W-(W/2)+10 ) || (Y[i] < (H/2)-10) || (Y[i] > H-(H/2)+10))

layer.visibility=onvis;

else{

layer.visibility=offvis;

if (Brwsr){layer.bgColor='aaaaaa';layer.clip.height=1;layer.clip.width=1}

else {layer.background='aaaaaa';layer.height=1;layer.width=1;layer.fontSize=1}

}

}

setTimeout('fly()',10);

}

window.onload=fly;

//-->

</script>


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.