This script places star images at random positions on your page that fade-in and fade-out. Place the following code in a custom header:
<script type="text/javascript">
<!-- Copyright 9dir.com 2006 (Konstantinos Hatzopoulos)
var sv = new Array;
// *** START USER CHANGES ***
sv[15]="star.gif"; // The star image path and name
sv[0]=15; // The number of the stars
sv[1]=20; // Minimum speed (the lower the faster)
sv[12]=70; // Maximum speed (it should be greater then minimum speed)
sv[4]=20; // Minimum size (the lower the smaller)
sv[5]=50; // Maximum size (it should be greater then minimum size)
sv[3]=1000; // Reappearance time (1000 is one second)
// *** END USER CHANGES ***
// -- DO NOT MODIFY BELOW THIS LINE --
sv[2]=sv[12]-sv[1];
sv[11]=sv[5]-sv[4];
for (var to=1; to < sv[0]; to++) {
var ato="astir"+to;
document.write('<img id='+ato+' STYLE="position:absolute; left:100; width:2; top:0; height:2; visibility:visible; Z-INDEX:9999" src='+sv[15]+'>');
}
function isos() {
for (var to=1; to < sv[0]; to++) {
setTimeout ("ksana('"+to+"')", 10);
}
}
function ksana(to) {
var poso=Math.floor(Math.random()*sv[11])+sv[4];
var perx=Math.floor(Math.random()*(kx-poso))+document.body.scrollLeft;
var pery=Math.floor(Math.random()*(ky-poso))+document.body.scrollTop;
var se=Math.floor(Math.random()*sv[2])+sv[1];setTimeout ("anw('"+to+"','"+poso+"','"+perx+"','"+pery+"','"+se+"')", sv[3]);
}
function anw(to,poso,perx,pery,se) {
var ato="astir"+to;
var ayto=konstantinos(ato);
ayto.left = perx;
ayto.top = pery;
ayto.width=parseInt(ayto.width)+2;
ayto.height=parseInt(ayto.height)+2;
if (poso > 2) {
var poso=poso-2;
var perx=perx-1;
var pery=pery-1;
setTimeout ("anw('"+to+"','"+poso+"','"+perx+"','"+pery+"','"+se+"')", se);
}
else {
perx++;
pery++;
setTimeout ("katw('"+to+"','"+perx+"','"+pery+"','"+se+"')", se);
}
}
function katw(to,perx,pery,se) {
var ato="astir"+to;
var ayto=konstantinos(ato);
ayto.left = perx;
ayto.top = pery;
ayto.width=parseInt(ayto.width)-2;
ayto.height=parseInt(ayto.height)-2;
var elen=parseInt(ayto.width);
if (elen > 2) {
perx++;
pery++;
setTimeout ("katw('"+to+"','"+perx+"','"+pery+"','"+se+"')", se);
}
else {
setTimeout ("ksana('"+to+"')", se);
}
}
document.write('<DIV ID="9dir" STYLE="position:absolute; left:0; top:260; width:435; visibility:hidden; Z-INDEX:0;"><a href="http://www.9dir.com">http://www.9dir.com</a></div>');
function konstantinos(id) {
if (document.all) {
return document.all[id].style;
}
else if(document.layers) {
return document.layers[id];
}
else if(document.getElementById && document.getElementById(id) != null) {
return document.getElementById(id).style;
}
}
// -->
</script>There are 7 parameters that you can use to adjust the appearance of the stars on your page. They are indicated in the above script between the start and end user change lines. These user values are stored in an array, so be careful not to change only the value. The purpose of each parameter is explained in the script comments. The only parameter that you may need to change is the s[15] value. This specifies the location of the star image and can be a URL or a path/file location.
To use the script, place the following code into a code object and position it anywhere on your page:
<script type="text/javascript"> var ky=document.body.clientHeight; var kx=document.body.clientWidth; isos(); </script>
All you need now is a star image. These can be found at various free Internet sites or choose one from below (use your right-click menu to save the desired image). You can also download the entire set.
Contact the LowTechGeezer
VM User's Forum
Bruceee's Sandpit
Webmaster's Corner
Other Useful Sites