Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Javascript doesn't work in newer Mozillas...

Reply
Thread Tools

Javascript doesn't work in newer Mozillas...

 
 
Cat
Guest
Posts: n/a
 
      01-21-2005
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;he ight: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;he ight:2px;background:#ffffff;font-size:2px"></div>');
}
document.write('</div>');
document.write('</div>');
}
WinHeight =
(document.layers)?window.innerHeight:window.docume nt.body.clientHeight;
WinWidth =
(document.layers)?window.innerWidth:window.documen t.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() * 5 + 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() * 10 + 5;
}
function fly() {
var WinHeight =
(document.layers)?window.innerHeight:window.docume nt.body.clientHeight;
var WinWidth =
(document.layers)?window.innerWidth:window.documen t.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[i] -= Largespeed[i];
if (LargeXpos[i] < -10) {
LargeXpos[i] = WinWidth;
LargeYpos[i] = Math.round(Math.random() * WinHeight);
Largespeed[i] = Math.random() * 10 + 5;
}
if (ns) {
document.layers['ln'+i].left = LargeXpos[i];
document.layers['ln'+i].top = LargeYpos[i] + hscrll;
}
else {
li[i].style.pixelLeft = LargeXpos[i];
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() * 5 + 1;
}
if (ns) {
document.layers['sn'+i].left = SmallXpos[i];
document.layers['sn'+i].top = SmallYpos[i]+hscrll;
}
else {
si[i].style.pixelLeft = SmallXpos[i];
si[i].style.pixelTop = SmallYpos[i]+hscrll;
}
}
setTimeout('fly()', 10);
}
// End -->


</SCRIPT>
 
Reply With Quote
 
 
 
 
Richard
Guest
Posts: n/a
 
      01-21-2005
On Fri, 21 Jan 2005 15:36:03 +0100 Cat wrote:

> 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).


Maybe due to the ancient ways of doing things.

document.write('</div>');
document.write('</div>');
document.write('<div style="position:absolute;top:0px;left:0px">');
document.write('<div style="position:relative">');


Convert all of this stuff into css.
<div> should come before </div> not as you show it.

in css it would look like
div.sample { position:absolute; top:0px; left;0px; }

<div class="sample">text</div>

You might want to brush up on existing acceptable JS conventions.
Then tweak your script accordingly.


 
Reply With Quote
 
 
 
 
Robert
Guest
Posts: n/a
 
      01-21-2005
In article <(E-Mail Removed)>, Cat <(E-Mail Removed)> wrote:

> 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).


This script contains the Netscape 4.x layer tag. This tag was dropped
from the Gekco base browsers. Netscape 6.x, firefox, etc. This is the
reason for the failure.

Rbert
 
Reply With Quote
 
Spats30
Guest
Posts: n/a
 
      01-21-2005
Couple of things: almost no-one is supporting NS 4.x vesions anymore.
It's usage is nominal, anymore, so remove it.

Then what is happening in your script is that the logic checks for old
NS versions (document.layers), if found, then use these specific old NS
properties, else assume IE and use proprietary IE properties. Newer NS
and Firefox browsers follow the ECMA standards better and don't support
either set of proprietary properties used in your script.

What you should do is search for a whole new script, or go through
manually, and replace anything with document.layers with new code
supported by NS 6+. It would take a long time to be more specific for
this post, but followup on your own and you'll learn a lot along the
way.



Cat wrote:
> 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;he ight: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;he ight:2px;background:#ffffff;font-size:2px"></div>');
> }
> document.write('</div>');
> document.write('</div>');
> }
> WinHeight =
>

(document.layers)?window.innerHeight:window.docume nt.body.clientHeight;
> WinWidth =
> (document.layers)?window.innerWidth:window.documen t.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() * 5 + 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() * 10 + 5;
> }
> function fly() {
> var WinHeight =
>

(document.layers)?window.innerHeight:window.docume nt.body.clientHeight;
> var WinWidth =
> (document.layers)?window.innerWidth:window.documen t.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[i] -= Largespeed[i];
> if (LargeXpos[i] < -10) {
> LargeXpos[i] = WinWidth;
> LargeYpos[i] = Math.round(Math.random() * WinHeight);
> Largespeed[i] = Math.random() * 10 + 5;
> }
> if (ns) {
> document.layers['ln'+i].left = LargeXpos[i];
> document.layers['ln'+i].top = LargeYpos[i] + hscrll;
> }
> else {
> li[i].style.pixelLeft = LargeXpos[i];
> 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() * 5 + 1;
> }
> if (ns) {
> document.layers['sn'+i].left = SmallXpos[i];
> document.layers['sn'+i].top = SmallYpos[i]+hscrll;
> }
> else {
> si[i].style.pixelLeft = SmallXpos[i];
> si[i].style.pixelTop = SmallYpos[i]+hscrll;
> }
> }
> setTimeout('fly()', 10);
> }
> // End -->
>
>
> </SCRIPT>


 
Reply With Quote
 
Lee
Guest
Posts: n/a
 
      01-21-2005
Robert said:
>
>In article <(E-Mail Removed)>, Cat <(E-Mail Removed)> wrote:
>
>> 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).

>
>This script contains the Netscape 4.x layer tag. This tag was dropped
>from the Gekco base browsers. Netscape 6.x, firefox, etc. This is the
>reason for the failure.


Since there is no document.layers object, it doesn't detect modern
Netscape as being Netscape at all, and so it never writes the LAYER
tags. It writes the IE code, instead.

However, even the IE code is garbage. It creates multiple <div>
tags with the same ID and then refers to them as elements of a
global array by the name of that ID tag.

It's pretty sad that IE tolerates this garbage.

You would be better off find new code. This sort of thing should be
available.

 
Reply With Quote
 
RobB
Guest
Posts: n/a
 
      01-21-2005
Lee wrote:
> Robert said:
> >
> >In article <(E-Mail Removed)>, Cat <(E-Mail Removed)> wrote:
> >
> >> 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).

> >
> >This script contains the Netscape 4.x layer tag. This tag was

dropped
> >from the Gekco base browsers. Netscape 6.x, firefox, etc. This is

the
> >reason for the failure.

>
> Since there is no document.layers object, it doesn't detect modern
> Netscape as being Netscape at all, and so it never writes the LAYER
> tags. It writes the IE code, instead.
>
> However, even the IE code is garbage. It creates multiple <div>
> tags with the same ID and then refers to them as elements of a
> global array by the name of that ID tag.
>
> It's pretty sad that IE tolerates this garbage.
>
> You would be better off find new code. This sort of thing should be
> available.


Lee pretty much covered it ('garbage')...in addition, the script is
written in such a way as to optimize differences in animation
efficiencies between (some) browsers, making any sort of uniform
timebase a kludge at best. style.pixelLeft/Top are IE-only. In any
event...dumped the LAYERS, cleaned it up a bit. Whatever.

<html>
<head>
<title>untitled</title>
</head>
<body bgcolor="#000000"
onresize="window.location.reload()"
onload="setInterval('fly()', window.createPopup?80:1);"><!-- a little
speed equalization -->
<script type="text/javascript">

var SmallStars = 27;
var LargeStars = 3;
var SmallYpos = [];
var SmallXpos = [];
var LargeYpos = [];
var LargeXpos = [];
var Smallspeed = [];
var Largespeed = [];
document.write(
'<div style="position:absolute;top:0px;left:0px;">',
'<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:#fff;',
'font-size:1px;"></div>'
);
}
document.write(
'</div>','</div>',
'<div style="position:absolute;top:0;left:0;">',
'<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:#fff;',
'font-size:2px;"></div>'
);
}
document.write('</div>','</div>');
WinHeight = ('undefined' != typeof window.innerHeight)?
window.innerHeight : document.body.clientHeight;
WinWidth = ('undefined' != typeof window.innerWidth)?
window.innerWidth-5 : document.body.clientWidth-5;
for (i = 0; i < SmallStars; i++) {
SmallYpos[i] = Math.round(Math.random() * WinHeight);
SmallXpos[i] = Math.round(Math.random() * WinWidth);
Smallspeed[i]= Math.random() * 5 + 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() * 10 + 5;
}

function fly() {
var hscrll = ('undefined' != typeof window.pageYOffset)?
window.pageYOffset : document.body.scrollTop;
var wscrll = ('undefined' != typeof window.pageXOffset)?
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() * 10 + 5;
}
}
i = 0;
while (li = document.getElementById('li' + i)) {
li.style.left = LargeXpos[i] + 'px';
li.style.top = LargeYpos[i++] + hscrll + 'px';
}
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() * 5 + 1;
}
}
i = 0;
while (si = document.getElementById('si' + i)) {
si.style.left = SmallXpos[i] + 'px';
si.style.top = SmallYpos[i++] + hscrll + 'px';
}
}

</script>
</body>
</html>

 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      01-21-2005
Richard wrote:
> On Fri, 21 Jan 2005 15:36:03 +0100 Cat wrote:
>
>
>>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).

>
>
> Maybe due to the ancient ways of doing things.
>
> document.write('</div>');
> document.write('</div>');
> document.write('<div style="position:absolute;top:0px;left:0px">');
> document.write('<div style="position:relative">');
>
>
> Convert all of this stuff into css.
> <div> should come before </div> not as you show it.


To the OP: Ignore the above advice. If Richard had bothered to *read*
the code, he would have noticed that it does indeed have them in the
correct order. It's typical of his hairbrained replies.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
 
Reply With Quote
 
RobB
Guest
Posts: n/a
 
      01-22-2005

(snip)

OK, cleaned this up a bit. Beware of lunatic line breaking courtesy of
googlegroups (turn on error reporting and look for unterminated
strings).

<html>
<head>
<title>untitled</title>
</head>
<body style="background:#000;"
onresize="window.location.reload()"
onload="if(document.getElementById)setInterval('fl y()', 40)">
<script type="text/javascript">

var SmallStars = 27;
var LargeStars = 3;
var SmallYpos = [];
var SmallXpos = [];
var LargeYpos = [];
var LargeXpos = [];
var Smallspeed = [];
var Largespeed = [];
document.write(
'<div style="position:absolute;top:0px;left:0px;">',
'<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:#fff;',
'font-size:1px;"></div>'
);
}
document.write(
'</div>','</div>',
'<div style="position:absolute;top:0;left:0;">',
'<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:#fff;',
'font-size:2px;"></div>'
);
}
document.write('</div>','</div>');
WinHeight = ('undefined' != typeof window.innerHeight)?
window.innerHeight : document.body.clientHeight;
WinWidth = ('undefined' != typeof window.innerWidth)?
window.innerWidth-5 : document.body.clientWidth-5;
for (i = 0; i < SmallStars; i++) {
SmallYpos[i] = Math.round(Math.random() * WinHeight);
SmallXpos[i] = Math.round(Math.random() * WinWidth);
Smallspeed[i]= Math.random() * 5 + 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() * 10 + 5;
}

function fly() {
var hscrll = ('undefined' != typeof window.pageYOffset)?
window.pageYOffset : document.body.scrollTop;
var wscrll = ('undefined' != typeof window.pageXOffset)?
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() * 10 + 5;
}
}
i = 0;
while (li = document.getElementById('li' + i)) {
li.style.left = LargeXpos[i] + 'px';
li.style.top = LargeYpos[i++] + hscrll + 'px';
}
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() * 5 + 1;
}
}
i = 0;
while (si = document.getElementById('si' + i)) {
si.style.left = SmallXpos[i] + 'px';
si.style.top = SmallYpos[i++] + hscrll + 'px';
}
}

</script>
</body>
</html>

 
Reply With Quote
 
Cat
Guest
Posts: n/a
 
      01-22-2005
Hi,

thank you so very much for this, it works like a charm now.
I read the newsgroups in my old Netscape 4.8 still, so I don't
have problems with the linebreaks.

I will go through it and see where you made changes, hopefully
I learn something from it. For some reason, Javascript, like
cgi, comes terribly hard to me, even though I love to use it.
Maybe because it has something to do with logic, that's just not
my world (I'm a former painter that started out as a designer,
still longing for the brushes..

Thanks again,

Cat



RobB wrote:
>
> (snip)
>
> OK, cleaned this up a bit. Beware of lunatic line breaking courtesy of
> googlegroups (turn on error reporting and look for unterminated
> strings).
>
> <html>
> <head>
> <title>untitled</title>
> </head>
> <body style="background:#000;"
> onresize="window.location.reload()"
> onload="if(document.getElementById)setInterval('fl y()', 40)">
> <script type="text/javascript">
>
> var SmallStars = 27;
> var LargeStars = 3;
> var SmallYpos = [];
> var SmallXpos = [];
> var LargeYpos = [];
> var LargeXpos = [];
> var Smallspeed = [];
> var Largespeed = [];
> document.write(
> '<div style="position:absolute;top:0px;left:0px;">',
> '<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:#fff;',
> 'font-size:1px;"></div>'
> );
> }
> document.write(
> '</div>','</div>',
> '<div style="position:absolute;top:0;left:0;">',
> '<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:#fff;',
> 'font-size:2px;"></div>'
> );
> }
> document.write('</div>','</div>');
> WinHeight = ('undefined' != typeof window.innerHeight)?
> window.innerHeight : document.body.clientHeight;
> WinWidth = ('undefined' != typeof window.innerWidth)?
> window.innerWidth-5 : document.body.clientWidth-5;
> for (i = 0; i < SmallStars; i++) {
> SmallYpos[i] = Math.round(Math.random() * WinHeight);
> SmallXpos[i] = Math.round(Math.random() * WinWidth);
> Smallspeed[i]= Math.random() * 5 + 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() * 10 + 5;
> }
>
> function fly() {
> var hscrll = ('undefined' != typeof window.pageYOffset)?
> window.pageYOffset : document.body.scrollTop;
> var wscrll = ('undefined' != typeof window.pageXOffset)?
> 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() * 10 + 5;
> }
> }
> i = 0;
> while (li = document.getElementById('li' + i)) {
> li.style.left = LargeXpos[i] + 'px';
> li.style.top = LargeYpos[i++] + hscrll + 'px';
> }
> 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() * 5 + 1;
> }
> }
> i = 0;
> while (si = document.getElementById('si' + i)) {
> si.style.left = SmallXpos[i] + 'px';
> si.style.top = SmallYpos[i++] + hscrll + 'px';
> }
> }
>
> </script>
> </body>
> </html>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code? Casey Hawthorne Python 1 01-24-2009 09:27 PM
Does DVD Genie still work on newer PCs after having SP2 installed? E. Scrooge NZ Computing 9 10-15-2006 10:48 AM
Will my charger work with newer batteries JM Digital Photography 4 03-13-2006 07:37 PM
Total flash size decreaing with newer IOS image on 2600 MC Cisco 1 02-24-2004 04:31 AM
disable JavaScript in newer browsers Kate Riley Javascript 2 07-23-2003 06:53 PM



Advertisments