Script Categories













Background Effects >>> Space Trip.

Travel through space with this cool background effect.

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
SmallStars = 30;
LargeStars
= 10;
SmallYpos = new Array();
SmallXpos = new Array();
LargeYpos = new Array();
LargeXpos = new Array();
Smallspeed= new Array();
Largespeed= new Array();
ns=(!document.all)?1:0;


document.write('<div style="position:absolute;top:0px;left:0px">');
document.write('<div style="position:relative">');
for (i = 0; i < SmallStars; i++) {
document.write('<div id="si'+i+'" style="position:absolute;top:0;left:0;width:1px;height:1px;background:#fffff0;font-size:1px"></div>');
}
document.write('</div>');
document.write('</div>');
document.write('<div style="position:absolute;top:0px;left:0px">');
document.write('<div style="position:relative">');
for (i = 0; i < LargeStars; i++) {
document.write('<div id="li'+i+'" style="position:absolute;top:0;left:0;width:2px;height:2px;background:#ffffff;font-size:2px"></div>');
}
document.write('</div>');
document.write('</div>');

WinHeight = (ns)?window.innerHeight:window.document.body.clientHeight;
WinWidth = (ns)?window.innerWidth:window.document.body.clientWidth;
for (i = 0; i < SmallStars; i++) {
SmallYpos[i] = Math.round(Math.random() * WinHeight);
SmallXpos[i] = Math.round(Math.random() * WinWidth);
Smallspeed[i]= Math.random()  + 1;
}
for (i = 0; i < LargeStars; i++) {
LargeYpos[i] = Math.round(Math.random() * WinHeight);
LargeXpos[i] = Math.round(Math.random() * WinWidth);
Largespeed[i] = Math.random() * 2 + 5;
}
function fly() {
var WinHeight = (ns)?window.innerHeight:window.document.body.clientHeight;
var WinWidth = (ns)?window.innerWidth:window.document.body.clientWidth;
var hscrll = (ns)?window.pageYOffset:document.body.scrollTop;
var wscrll = (ns)?window.pageXOffset:document.body.scrollLeft;
for (i = 0; i < LargeStars; i++) {
LargeXpos[i] -= Largespeed[i];
if (LargeXpos[i] < -10) {
LargeXpos[i] = WinWidth;
LargeYpos[i] = Math.round(Math.random() * WinHeight);
Largespeed[i] = Math.random() * 2 + 5;
}
if (ns) {
document.getElementById("li"+i).style.left = LargeXpos[i];
document.getElementById('li'+i).style.top = LargeYpos[i] + hscrll;
}
else {
document.getElementById("li"+i).style.pixelLeft = LargeXpos[i];
document.getElementById("li"+i).style.pixelTop = LargeYpos[i] + hscrll;
   }
}
for (i = 0; i < SmallStars; i++) {
SmallXpos[i] -= Smallspeed[i];
if (SmallXpos[i] < -10) {
SmallXpos[i] = WinWidth;
SmallYpos[i] = Math.round(Math.random()*WinHeight);
Smallspeed[i] = Math.random()  + 1;
}
if (ns) {
document.getElementById('si'+i).style.left = SmallXpos[i];
document.getElementById('si'+i).style.top = SmallYpos[i]+hscrll;
}
else {
document.getElementById('si'+i).style.pixelLeft = SmallXpos[i];
document.getElementById('si'+i).style.pixelTop = SmallYpos[i]+hscrll;
   }
}
setTimeout('fly()', 10);
}
document.bgColor='black';
window.onload=fly;
//  End -->
</script>

Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

→ Come visit Odds805 To play situs judi online in Indonesia. komiku baca komik online


©