C
Cat
Greetings,
I have an old javascript effect that was running on some of my
sites for quite long, working fine in Netscape (up to 4.75) and
IE. It still works in the newer IEs, but not in the new Mozillas,
neither Firebird nor Firefox (and not in Netscape 7.something).
What is wrong with it? I'm no javascript expert, I just got it
from the net years ago, I don't even know where from. There is
no source url given in it to look up. I've added the code below.
I have exactly the same situation with two other scripts - they
worked for years and suddenly they seem to be 'expired' for Mozilla.
I think it's the same problem with all, so I hope if someone gives
me a helping hand with this one I might fiddle out the other two
as well.
Sorry for the long babble, and thanks to anyone who has the patience
to look over it,
Cat
<BODY BGCOLOR="#000000" ONLOAD="fly()">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
SmallStars = 27;
LargeStars = 3;
SmallYpos = new Array();
SmallXpos = new Array();
LargeYpos = new Array();
LargeXpos = new Array();
Smallspeed= new Array();
Largespeed= new Array();
ns=(document.layers)?1:0;
if (ns) {
for (i = 0; i < SmallStars; i++) {
document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#EEDBDB'
CLIP='0,0,1,1'></LAYER>");
}
for (i = 0; i < LargeStars; i++) {
document.write("<LAYER NAME='ln"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0'
CLIP='0,0,2,2'></LAYER>");
}
}
else {
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"
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"
style="position:absolute;top:0;left:0;width:2px;height:2px;background:#ffffff;font-size:2px"></div>');
}
document.write('</div>');
document.write('</div>');
}
WinHeight =
(document.layers)?window.innerHeight:window.document.body.clientHeight;
WinWidth =
(document.layers)?window.innerWidth:window.document.body.clientWidth;
for (i = 0; i < SmallStars; i++) {
SmallYpos = Math.round(Math.random() * WinHeight);
SmallXpos = Math.round(Math.random() * WinWidth);
Smallspeed= Math.random() * 5 + 1;
}
for (i = 0; i < LargeStars; i++) {
LargeYpos = Math.round(Math.random() * WinHeight);
LargeXpos = Math.round(Math.random() * WinWidth);
Largespeed = Math.random() * 10 + 5;
}
function fly() {
var WinHeight =
(document.layers)?window.innerHeight:window.document.body.clientHeight;
var WinWidth =
(document.layers)?window.innerWidth:window.document.body.clientWidth;
var hscrll =
(document.layers)?window.pageYOffset:document.body.scrollTop;
var wscrll =
(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i = 0; i < LargeStars; i++) {
LargeXpos -= Largespeed;
if (LargeXpos < -10) {
LargeXpos = WinWidth;
LargeYpos = Math.round(Math.random() * WinHeight);
Largespeed = Math.random() * 10 + 5;
}
if (ns) {
document.layers['ln'+i].left = LargeXpos;
document.layers['ln'+i].top = LargeYpos + hscrll;
}
else {
li.style.pixelLeft = LargeXpos;
li.style.pixelTop = LargeYpos + hscrll;
}
}
for (i = 0; i < SmallStars; i++) {
SmallXpos -= Smallspeed;
if (SmallXpos < -10) {
SmallXpos = WinWidth;
SmallYpos = Math.round(Math.random()*WinHeight);
Smallspeed = Math.random() * 5 + 1;
}
if (ns) {
document.layers['sn'+i].left = SmallXpos;
document.layers['sn'+i].top = SmallYpos+hscrll;
}
else {
si.style.pixelLeft = SmallXpos;
si.style.pixelTop = SmallYpos+hscrll;
}
}
setTimeout('fly()', 10);
}
// End -->
</SCRIPT>
I have an old javascript effect that was running on some of my
sites for quite long, working fine in Netscape (up to 4.75) and
IE. It still works in the newer IEs, but not in the new Mozillas,
neither Firebird nor Firefox (and not in Netscape 7.something).
What is wrong with it? I'm no javascript expert, I just got it
from the net years ago, I don't even know where from. There is
no source url given in it to look up. I've added the code below.
I have exactly the same situation with two other scripts - they
worked for years and suddenly they seem to be 'expired' for Mozilla.
I think it's the same problem with all, so I hope if someone gives
me a helping hand with this one I might fiddle out the other two
as well.
Sorry for the long babble, and thanks to anyone who has the patience
to look over it,
Cat
<BODY BGCOLOR="#000000" ONLOAD="fly()">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
SmallStars = 27;
LargeStars = 3;
SmallYpos = new Array();
SmallXpos = new Array();
LargeYpos = new Array();
LargeXpos = new Array();
Smallspeed= new Array();
Largespeed= new Array();
ns=(document.layers)?1:0;
if (ns) {
for (i = 0; i < SmallStars; i++) {
document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#EEDBDB'
CLIP='0,0,1,1'></LAYER>");
}
for (i = 0; i < LargeStars; i++) {
document.write("<LAYER NAME='ln"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0'
CLIP='0,0,2,2'></LAYER>");
}
}
else {
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"
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"
style="position:absolute;top:0;left:0;width:2px;height:2px;background:#ffffff;font-size:2px"></div>');
}
document.write('</div>');
document.write('</div>');
}
WinHeight =
(document.layers)?window.innerHeight:window.document.body.clientHeight;
WinWidth =
(document.layers)?window.innerWidth:window.document.body.clientWidth;
for (i = 0; i < SmallStars; i++) {
SmallYpos = Math.round(Math.random() * WinHeight);
SmallXpos = Math.round(Math.random() * WinWidth);
Smallspeed= Math.random() * 5 + 1;
}
for (i = 0; i < LargeStars; i++) {
LargeYpos = Math.round(Math.random() * WinHeight);
LargeXpos = Math.round(Math.random() * WinWidth);
Largespeed = Math.random() * 10 + 5;
}
function fly() {
var WinHeight =
(document.layers)?window.innerHeight:window.document.body.clientHeight;
var WinWidth =
(document.layers)?window.innerWidth:window.document.body.clientWidth;
var hscrll =
(document.layers)?window.pageYOffset:document.body.scrollTop;
var wscrll =
(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i = 0; i < LargeStars; i++) {
LargeXpos -= Largespeed;
if (LargeXpos < -10) {
LargeXpos = WinWidth;
LargeYpos = Math.round(Math.random() * WinHeight);
Largespeed = Math.random() * 10 + 5;
}
if (ns) {
document.layers['ln'+i].left = LargeXpos;
document.layers['ln'+i].top = LargeYpos + hscrll;
}
else {
li.style.pixelLeft = LargeXpos;
li.style.pixelTop = LargeYpos + hscrll;
}
}
for (i = 0; i < SmallStars; i++) {
SmallXpos -= Smallspeed;
if (SmallXpos < -10) {
SmallXpos = WinWidth;
SmallYpos = Math.round(Math.random()*WinHeight);
Smallspeed = Math.random() * 5 + 1;
}
if (ns) {
document.layers['sn'+i].left = SmallXpos;
document.layers['sn'+i].top = SmallYpos+hscrll;
}
else {
si.style.pixelLeft = SmallXpos;
si.style.pixelTop = SmallYpos+hscrll;
}
}
setTimeout('fly()', 10);
}
// End -->
</SCRIPT>