473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Netscape 7.02 - script problem.

Netscape 7.02 is giving me a headache with a downloaded snow script.
Starting with a blank page, I inserted the script and checked it in IE
6 and Netscape 7.02. Everything worked and looked fine. A check on CPU
usage (Windows Task Manager>Performance) gave a 0% to 2% reading for
both browsers on a Pentium 4, 3.06GHz running XP.

As I added text, images, tiled background and so on. I noticed the
mouse was becoming jerky in Netscape 7. Another CPU usage check now
gave a 98% peak reading for N7 but still 2% in IE??

I removed the tiled background jpg, which brought it down to 33%. Then
removed the text and images, now a blank page again except for the
script, which returned it to 0% to 2%!

Is there a problem with this script or is it down to Netscape 7? I've
used loads of animation scripts before in trusty old Netscape 4 and
never had any problems like this - I've not long upgraded to 7.

Anyway, the script I'm using is from
http://www.btinternet.com/~kurt.grig...t/SnowImg.html
Is it duff and if so where can I find another? The page is for my
9-year-old daughter, she really wants a snow theme and Daddies looking
a bit dim at the moment.

Thanks for any help,
Jonny.
Jul 20 '05 #1
11 1804
although this is a rather poorly programmed script, Netscape is to blame.

I have only looked at it in MSIE 6 and Mozilla Firebird 0.7, and experianced
similar issues, it seems that MSIE has a much cleaner way of drawing the
webpages, which means that when something is being drawn over and over it
slows the computer down much more.

Here is the easiest solution I can come up with:
change this line:
runspeed=40; //setTimeout speed!

to something like this:
runspeed=navigator.appName == "Microsoft Internet Explorer"?40:500;
//setTimeout speed!

This is not a great solution as it makes the snow jumpy on non MSIE
browsers, but it will save your CPU and stop the mouse jumping

"Jonny" <jo**********@yahoo.co.uk> wrote in message
news:f4**************************@posting.google.c om...
Netscape 7.02 is giving me a headache with a downloaded snow script.
Starting with a blank page, I inserted the script and checked it in IE
6 and Netscape 7.02. Everything worked and looked fine. A check on CPU
usage (Windows Task Manager>Performance) gave a 0% to 2% reading for
both browsers on a Pentium 4, 3.06GHz running XP.

As I added text, images, tiled background and so on. I noticed the
mouse was becoming jerky in Netscape 7. Another CPU usage check now
gave a 98% peak reading for N7 but still 2% in IE??

I removed the tiled background jpg, which brought it down to 33%. Then
removed the text and images, now a blank page again except for the
script, which returned it to 0% to 2%!

Is there a problem with this script or is it down to Netscape 7? I've
used loads of animation scripts before in trusty old Netscape 4 and
never had any problems like this - I've not long upgraded to 7.

Anyway, the script I'm using is from
http://www.btinternet.com/~kurt.grig...t/SnowImg.html
Is it duff and if so where can I find another? The page is for my
9-year-old daughter, she really wants a snow theme and Daddies looking
a bit dim at the moment.

Thanks for any help,
Jonny.

Jul 20 '05 #2
"neerolyte" <ne*******@netspace.nOsPaM.net.au> wrote in message news:<bt**********@otis.netspace.net.au>...
although this is a rather poorly programmed script, Netscape is to blame.

I have only looked at it in MSIE 6 and Mozilla Firebird 0.7, and experianced
similar issues, it seems that MSIE has a much cleaner way of drawing the
webpages, which means that when something is being drawn over and over it
slows the computer down much more.

Here is the easiest solution I can come up with:
change this line:
runspeed=40; //setTimeout speed!

to something like this:
runspeed=navigator.appName == "Microsoft Internet Explorer"?40:500;
//setTimeout speed!

This is not a great solution as it makes the snow jumpy on non MSIE
browsers, but it will save your CPU and stop the mouse jumping


For any animated script, the timeout/interval has to be at least 50ms.
Any lower and it just is NOT animated. Netscape 4 handled this sort of
script with ease as IE continues to.

Whether the new Netscape's & Opera's are or nor "technically correct"
in their redrawing is beside the point. They are alienating lots of
people who like this sort of script and helping IE towards total
domination.

As for the script in question, It has an option to hide itself from
Netscape 7; I'd just use that and forget about it. You can try
http://www.dynamicdrive.com for something else.
Jul 20 '05 #3
DU
neerolyte wrote:
although this is a rather poorly programmed script, Netscape is to blame.

In part, this is true. Mozilla-based browsers are struggling with very
demanding animation DHMTL scripts. This is exactly the case here:

Bug 64516: 95-99% CPU usage for dhtml "snow effect"
http://bugzilla.mozilla.org/show_bug.cgi?id=64516

Bug 186442: "snowfall" script causes browser to slow to a crawl
http://bugzilla.mozilla.org/show_bug.cgi?id=186442
I have only looked at it in MSIE 6 and Mozilla Firebird 0.7, and experianced
similar issues, it seems that MSIE has a much cleaner way of drawing the
webpages, which means that when something is being drawn over and over it
slows the computer down much more.

Yep!
Here is the easiest solution I can come up with:
change this line:
runspeed=40; //setTimeout speed!

to something like this:
runspeed=navigator.appName == "Microsoft Internet Explorer"?40:500;
This is not the best way to detect browsers. Anyway, I think the main
issue is the setTimeout value. I still don't recommend anything under
64msec or even 128msec for such page. The original poster has a 3Ghz
cpu: that,s not the case for many users.
//setTimeout speed!

Correct again! There are a lot of badly coded scripts out there in
Cut-N-Paste javascript sites which mindlessly have scripts resorting to
insane setTimeout values demanding insane cpu, video and memory resources.


This is not a great solution as it makes the snow jumpy on non MSIE
browsers, but it will save your CPU and stop the mouse jumping

It is a better solution than you may think. setTimeout values (in
particular in recursive calls and intense DHTML animations) should never
be faster than 64 msec. for demanding scripts. Even MSDN says so too.

"Code optimization:
setTimeout
Speaking of animation, one of the most common techniques for animating
elements is to use a timer with window.setTimeout to position an element
on the page incrementally. A quick tip: Use as few timers as possible.
Timers consume valuable system resources, and the behavior of multiple
timers, all working together, will greatly vary on differently powered
machines. A way to animate multiple elements, while minimizing timer
use, is to employ a single main loop, powered with a single
window.setTimeout() call. In that single loop, keep a list of all
elements you need to manipulate. Loop through that list with each tick,
and perform your required move."
Michael Wallent
Microsoft Corporation
http://msdn.microsoft.com/library/de...l/dude1201.asp

DU

"Jonny" <jo**********@yahoo.co.uk> wrote in message
news:f4**************************@posting.google.c om...
Netscape 7.02 is giving me a headache with a downloaded snow script.
Starting with a blank page, I inserted the script and checked it in IE
6 and Netscape 7.02. Everything worked and looked fine. A check on CPU
usage (Windows Task Manager>Performance) gave a 0% to 2% reading for
both browsers on a Pentium 4, 3.06GHz running XP.

As I added text, images, tiled background and so on. I noticed the
mouse was becoming jerky in Netscape 7. Another CPU usage check now
gave a 98% peak reading for N7 but still 2% in IE??

I removed the tiled background jpg, which brought it down to 33%. Then
removed the text and images, now a blank page again except for the
script, which returned it to 0% to 2%!

Is there a problem with this script or is it down to Netscape 7? I've
used loads of animation scripts before in trusty old Netscape 4 and
never had any problems like this - I've not long upgraded to 7.

Anyway, the script I'm using is from
http://www.btinternet.com/~kurt.grig...t/SnowImg.html
Is it duff and if so where can I find another? The page is for my
9-year-old daughter, she really wants a snow theme and Daddies looking
a bit dim at the moment.

Thanks for any help,
Jonny.


Jul 20 '05 #4
Lee
Mike said:
Whether the new Netscape's & Opera's are or nor "technically correct"
in their redrawing is beside the point. They are alienating lots of
people who like this sort of script and helping IE towards total
domination.

As for the script in question, It has an option to hide itself from
Netscape 7; I'd just use that and forget about it. You can try
http://www.dynamicdrive.com for something else.


Apparently, no version of Netscape beyond 4 was available to the
author when he wrote the code. It treats it as an "other" browser,
and not very efficiently. Blaming the browser for having trouble
with bad code is one reason why IE is the predominant browser among
people who don't know any better.

Jul 20 '05 #5
Lee <RE**************@cox.net> wrote in message news:<bt*********@drn.newsguy.com>...
Apparently, no version of Netscape beyond 4 was available to the
author when he wrote the code. It treats it as an "other" browser,
and not very efficiently. Blaming the browser for having trouble
with bad code is one reason why IE is the predominant browser among
people who don't know any better.


The coding for the script isn't bad at all. The main repeating
function is very basic:

Increase y-pos at a random speed, give x-pos a bit of a wiggle.
When y-pos reaches the bottom of the page, reset y-pos, x-pos and
speed.
Assign y-pos, x-pos and speed to the objects[snow flakes] and repeat.
Simple.

Making it even more basic by removing the x-pos wiggle and the
scrolling doesn't affect the high cpu strain in N7, it's just as high.
The OP's tiled background problem is also true and a new one to me,
very odd and not acceptable.

I'm not for or anti any browser but N7 is not cutting the mustard with
dhtml.
Jul 20 '05 #6
DU
Mike wrote:
Lee <RE**************@cox.net> wrote in message news:<bt*********@drn.newsguy.com>...

Apparently, no version of Netscape beyond 4 was available to the
author when he wrote the code. It treats it as an "other" browser,
and not very efficiently. Blaming the browser for having trouble
with bad code is one reason why IE is the predominant browser among
people who don't know any better.

The coding for the script isn't bad at all. The main repeating
function is very basic:

Increase y-pos at a random speed, give x-pos a bit of a wiggle.
When y-pos reaches the bottom of the page, reset y-pos, x-pos and
speed.
Assign y-pos, x-pos and speed to the objects[snow flakes] and repeat.
Simple.


The algorithm as described is simple; the implementation in conformance
to W3C web standards is another issue and you want to support MSIE 6 for
windows when triggered in stdandards compliant rendering mode. The page
is far, very very far from such goal.
Making it even more basic by removing the x-pos wiggle and the
scrolling doesn't affect the high cpu strain in N7, it's just as high.
The OP's tiled background problem is also true and a new one to me,
very odd and not acceptable.

I'm not for or anti any browser but N7 is not cutting the mustard with
dhtml.

You first have to establish that the code is well written, robust,
compliant with widely established and acknowleged W3C web standards like
HTML 4.01, W3C DOM 2 events attributes and methods, W3C DOM Core
attributes and methods. Here, that page markup code does not even
validate, the browser detection is old, outdated and will often fail, it
resorts to document.write() calls in IE for no good reasons, it does not
use any DOM 2 events method, even the measurements of the viewport is
wrong for MSIE unless backward compatible rendering mode is used, etc..
For many reasons, professional web designers would judge that code as
not good at all.

Once and only once you have in front of you a well written code you can
assess (and compare with other browsers) the NS 7.x DHTML performance on
one single highly-resource-demanding animation script.

DU
Jul 20 '05 #7
Thanks all but I'm still having no luck with Netscape 7. I tried the
Snow Effect at
http://www.dynamicdrive.com/dynamicindex3/snow.htm
A slightly higher CPU reading than the first script and a full 100%
reading for Netscape 7 with a tiled background - I just don't get what
the background deal is about!

I also tried Snowmaker at
http://www.24fun.com/downloadcenter/snow/snow.html
The CPU reading was 30% for N7 (10 flakes) with a background, 0%
without. This one doesn't use images and isn't as pretty as the other
two.

Oh well, I'll stick with the first script and use its N7 hide feature.
It looks the best and I also like its timed clear out part.

Thanks again,
Jonny.
Jul 20 '05 #8
DU
Jonny wrote:
Thanks all but I'm still having no luck with Netscape 7. I tried the
Snow Effect at
http://www.dynamicdrive.com/dynamicindex3/snow.htm
A slightly higher CPU reading than the first script and a full 100%
reading for Netscape 7 with a tiled background - I just don't get what
the background deal is about!

I also tried Snowmaker at
http://www.24fun.com/downloadcenter/snow/snow.html
The CPU reading was 30% for N7 (10 flakes) with a background, 0%
without. This one doesn't use images and isn't as pretty as the other
two.

Oh well, I'll stick with the first script and use its N7 hide feature.
It looks the best and I also like its timed clear out part.

Thanks again,
Jonny.

You have not really understood all I wrote in my previous post. Here are
recommendations for you.

1- Make sure the page which will host this snow flakes falling randomly
uses valid, validated markup code. That means a correct and valid
doctype declaration, preferably a strict definition like HTML 4.01
strict along with a character encoding declaration:

W3C Quality Assurance tip
Don't forget to add a doctype:
http://www.w3.org/QA/Tips/Doctype

List of valid DTDs you can use in your document.
http://www.w3.org/QA/2002/04/valid-dtd-list.html

W3C validator:
http://validator.w3.org/

The Importance of Code Validation
http://www.wats.ca/articles/htmlvalidation/28

Why we won’t help you:
http://diveintomark.org/archives/200..._wont_help_you

Activating the Right Layout Mode Using the Doctype Declaration
http://www.hut.fi/u/hsivonen/doctype.html

2- Make sure you understand the javascript code and that you know for a
fact that it is optimized and that it will overwhelm users with modest
cpu/RAM/video resources. That means to limit the number of snow flakes
and recursive calls at set intervals. In other words, don't go with a
setTimeout(expr, 40)
but rather give preference to
setTimeout(expr, 128)
There are number of code optimization techniques available to make your
webpage code size, download time, parsing and rendering in browsers
small, fast, optimal. Same thing with optimization the CSS code and the
javascript code.

3- The %tage of cpu activity is just a sign, a symptom if you wish, of
the burden imposed onto the user's system resources by the script
functions. It is true that NS 7.1 and Mozilla-based browsers (compared
to MSIE 6 for windows for instance) is more sensitive to issues and
matters related to DHTML performance in animation scripts (and there is
a meta-bugfile at bugzilla on DHTML performance improvements) but IMO
this should not be a decisive factor. Good and optimized script
functions will be able to run on modest systems.
You gave %tage of cpu activity and you're using a 3Ghz cpu: consider the
ordinary visitor with a 500Mhz cpu to 1Ghz cpu.

In every single page, url you mentioned, none of them actually were
meeting the requirements I gave here.

Finally, consider that snow flakes effect are only cosmetic ornemental
graphical effects adding/bringing no content per se to a page but
demanding considerably quite a lot from the visitor's system; after a
while (a min or so), users get tired of it (it was established that
constantly running, moving graphics disturb and diminish peripherical
vision and concentration to read) and wish they could turn it off...only
to realize that they can't!

DU
Jul 20 '05 #9
DU <dr*******@hotREMOVETHISmail.com> wrote in message news:<bt**********@news.eusc.inter.net>...
You first have to establish that the code is well written, robust,
compliant with widely established and acknowleged W3C web standards like
HTML 4.01, W3C DOM 2 events attributes and methods, W3C DOM Core
attributes and methods. Here, that page markup code does not even
validate, the browser detection is old, outdated and will often fail, it
resorts to document.write() calls in IE for no good reasons, it does not
use any DOM 2 events method, even the measurements of the viewport is
wrong for MSIE unless backward compatible rendering mode is used, etc..
For many reasons, professional web designers would judge that code as
not good at all.

Once and only once you have in front of you a well written code you can
assess (and compare with other browsers) the NS 7.x DHTML performance on
one single highly-resource-demanding animation script.

DU


Your points about correct/strict page markup are of course valid but
are not the answer here.

In Netscape 7:

Why does CPU usage 'dramatically' increase when it is asked to animate
multiple divisions containing "images"?

Why does CPU usage 'dramatically' increase when it is asked to animate
multiple divisions of "any sort" over a tiled background image?

The script in question may indeed be pointless but I'm very interested
DHTML games. These N7 "oddities" are a big deal.

Below is a simple animation script as basic as you can get. It's
strict compliant and for this test, IE vs N7, is perfectly adequete.
Run it in IE and Netscape 7 as is and note their respective CPU usage.

Now add a variety of tiled backgrounds to the body tag and again check
CPU usage.

Then place any image inside the "obj" div, alter div height/width
accordingly, and check again. I look forward to reading your results.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style>
..division{
position:absolute;top:0px;left:0px;
height:12px;width:12px;background:#ff0000;
}
</style>
</head>
<body>

<script>
t=new Array();y=new Array();x=new Array();
for (i=0; i < 30; i++){
document.write("<div id='obj"+i+"' class='division'></div>");
y[i]=i*13;
x[i]=parseInt(Math.random()*400);
t[i]=document.getElementById("obj"+i).style;
t[i].top=y[i]+"px";
}

function ini(){
for (i=0; i < 30; i++){
x[i]++;
if (x[i] >= 400) x[i]=0;
t[i].left=x[i]+"px";
}
setTimeout("ini()",50);
}
window.onload=ini;
//-->
</script>

</body>
</html>
Jul 20 '05 #10
Mike wrote:
<--snip-->
In Netscape 7:

Which N7? 7.02? Its old.
Why does CPU usage 'dramatically' increase when it is asked to animate
multiple divisions containing "images"?

Why does CPU usage 'dramatically' increase when it is asked to animate
multiple divisions of "any sort" over a tiled background image?

The script in question may indeed be pointless but I'm very interested
DHTML games. These N7 "oddities" are a big deal.

Below is a simple animation script as basic as you can get. It's
strict compliant and for this test, IE vs N7, is perfectly adequete.
Run it in IE and Netscape 7 as is and note their respective CPU usage.

Now add a variety of tiled backgrounds to the body tag and again check
CPU usage.

Then place any image inside the "obj" div, alter div height/width
accordingly, and check again. I look forward to reading your results.


Nothing I added to it in Netscape 7.1 slowed it down. It may very well
be something that got 'fixed' in the later revisions/versions of NS7.
--
Randy

Jul 20 '05 #11
Randy Webb <hi************@aol.com> wrote in message news:<yf********************@comcast.com>...
Mike wrote:
<--snip-->
In Netscape 7:


Which N7? 7.02? Its old.
Why does CPU usage 'dramatically' increase when it is asked to animate
multiple divisions containing "images"?

Why does CPU usage 'dramatically' increase when it is asked to animate
multiple divisions of "any sort" over a tiled background image?

The script in question may indeed be pointless but I'm very interested
DHTML games. These N7 "oddities" are a big deal.

Below is a simple animation script as basic as you can get. It's
strict compliant and for this test, IE vs N7, is perfectly adequete.
Run it in IE and Netscape 7 as is and note their respective CPU usage.

Now add a variety of tiled backgrounds to the body tag and again check
CPU usage.

Then place any image inside the "obj" div, alter div height/width
accordingly, and check again. I look forward to reading your results.


Nothing I added to it in Netscape 7.1 slowed it down. It may very well
be something that got 'fixed' in the later revisions/versions of NS7.


Yeah, I'm on 7.02. Very interesting, cheers Randy. I'll see if 7.1 is
on the .net magazine disc.
Jul 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Peter Bremer | last post by:
Hi all, I've written this little piece of code, which doesn't seem to work in Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found some indication that Netscape 6+ has the...
4
by: Federico Bari | last post by:
Good morning all from italy, i have probably a compatibility problem with a html/javascript page. The aim of the code of the file test.htm you find here following (copy the 3 files in the...
13
by: Gaurav | last post by:
Hello, i have some java script with in html. It runs fine on IE 6.0 but doesnt run on netscape 7.1 Can someone tell me whats the problem ? And how can i solve it. here is the url ...
2
by: Kevin Ly | last post by:
Consider the test case below. The onmouseout event does NOT fire when my mouse/cusor is moved off the left side of the browser. It does if it is moved off the top, bottom, and the right side that...
13
by: Julia Peterwitz | last post by:
I have a function that works with explorer but not with netscape. The problem is the function at line 5. 1 fSetSelectedDay(myElement){ 2 /* 3 ... 4 */ 5 var elementText =...
2
by: ALuPin | last post by:
Hi, when I try to see the effect of the following script I do not see anything when using Netscape Navigator whereas InternetExplorer ist ok. In Netscape Javascript is activated. What could...
4
by: Wm | last post by:
I have a script that changes a main/enlarged image when you click on a thumbnail. It works fine in IE, but for some reason it won't do anything in Netscape 7.1. Does anyone know if this is a...
5
by: Zambien | last post by:
Hi all, Here's my problem. I have tables that are using the menu/submenu idea for hiding rows. This works fine in IE (of course) and does show/hide correctly in netscape, but as soon as the...
5
by: moondaddy | last post by:
I have a <a> element in a datagrid which wraps some asp.net labels. this element also has an onclick event which does not fire in netscape 6 (and perhaps other browsers for all I know...). Below...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.