473,402 Members | 2,046 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,402 software developers and data experts.

Problems with Netscape

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 be the problem?

Thank you for your help.
<head>
<STYLE>.spanstyle {
COLOR: green; FONT-FAMILY: Verdana; FONT-SIZE: 10pt;
FONT-WEIGHT: bold; POSITION: absolute; TOP: -50px; VISIBILITY: visible
}
</STYLE>
<SCRIPT>
var x,y
var step=20
var flag=0
//
var message="THIS IS A TEST!!"
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) {
xpos[i]=-50
}
var ypos=new Array()
for (i=0;i<=message.length-1;i++) {
ypos[i]=-50
}
function handlerMM(e){
x = (document.layers) ? e.pageX :
document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY :
document.body.scrollTop+event.clientY
flag=1
}
function makesnake() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("makesnake()",30)
}
</SCRIPT>
</head>
<body onload="makesnake()" style="OVERFLOW-X: hidden; OVERFLOW-Y:
scroll; WIDTH: 100%" BACKGROUND>
<SCRIPT>
<!-- Beginning of JavaScript -
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// - End of JavaScript - -->
</SCRIPT>
</body>
</html>
Jul 23 '05 #1
2 1401
AL****@web.de (ALuPin) writes:
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 be the problem?
Probably you using proprietary IE features. Let's have a look

function handlerMM(e){
Looks like an event handler. That would mean that the 'e' is the event
in non-IE browsers (whereas IE keeps the event as the global variable
"event").
x = (document.layers) ? e.pageX :
document.body.scrollLeft+event.clientX
And right on, if document.layers exists, then "e" is used, otherwise
"event" is used. However, Netscape 6+ doesn't have a document.layers
object, but it should use the "e" varible, so this code fails completely.

It looks like it was written for IE and Netscape 4 exclusively, and
therefore it fails in all other browsers.
function makesnake() {
if (flag==1 && document.all) {
this test for "document.all" is probably meant to detect IE. That is
no longer the case. Other browsers, e.g., Opera, also has document.all
collections.
var thisspan = eval("span"+(i)+".style")
This is blatant misuse of eval, as well as IE specific coding.

If "i" is, e.g., 2, then this will evaluate the expression
"span2.style". I assume "span2" is the id/name of a span element. IE
makes global variables available that refer to named elements. Other
browsers does not.

It could just be written as:
window["span"+i]
in IE, and it would even be faster.
var thisspan = eval("document.span"+i)
This accesses "document.span2". It could just be written as:
document["span"+i];

Neither of these two access methods ("window['span'+i]" or
"document['span'+i]") will work in Netscape 6+. Instead you should use
"document.getElementById('span'+i)"
<body onload="makesnake()" style="OVERFLOW-X: hidden; OVERFLOW-Y:
scroll; WIDTH: 100%" BACKGROUND>
OVERFLOW-X and OVERFLOW-Y are prorietary IE features. The background
attribute should have a value.
<SCRIPT>
The "type" attribute is required on script tags in HTML 4. Use
<script type="text/javascript">
<!-- Beginning of JavaScript -


This line is not needed.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
ALuPin wrote:
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 be the problem? <snip> function makesnake() {
if (flag==1 && document.all) { <snip> var thisspan = eval("span"+(i)+".style")
Any script author who uses - eval - to resolve a dot notation property
accessor doesn't really understand javascript. Unsurprisingly people who
don't understand javascript don't tend to create very good scripts, so
expecting the results to be cross-browser or reliable is probably
unrealistic.

<snip> else if (flag==1 && document.layers) {

<snip>

This script has an - if(document.all){ - branch, which will be taken by
IE, Opera, Konqueror, Safari, IceBrowser and others. It also has an -
else if(document.layers) - branch, which would be followed by Netscape 4
and a couple of close imitators. But Netscape 6+ dropped the -
document.layers - collection in favour of implementing W3C DOM standards
and so there is no branch in this code that will be taken by Netscape
6+, Mozilla or any other Gecko-based browser.

The balance of probability is that this is a script from some published
copy-and-paste collection and was written at the time when IE 4 and
Netscape 4 were the dominant scriptable browsers, but is now out of date
(in its browser scripting and implementation style). That is the problem
with copy-and-paste scripts (apart from the lack of any qualified
quality control overseeing their publication); once they have been
placed on the Internet there they stay, a trap for the unwary and
contributing to making the internet worse when they find themselves
being used by people who don't know any better and only superficially
test in one browsers.

Richard.
Jul 23 '05 #3

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

Similar topics

1
by: Phong Ho | last post by:
Hi everyone, I am using PHP and MySQL to create a dynamic website. Using MS Internet Explorer to test my website, everything works fine. When I use Netscape and Opera to test my work, I have...
6
by: Ingmund Sjåstad | last post by:
Trying to make a dropdown menu. I working nice in IE6 but when I try a link in Netscape 7 nothing happens. Can anybody help me? <html> <head> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0...
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
3
by: Laiverd.COM | last post by:
Hi everybody, Since today the pages at http://www.laiverd.com/groundzero/anima have problems with the hover-styles in Netscape 7.1 (no problems in Mozilla, Firefox and IE on Windows). I am not...
2
by: Joy | last post by:
Hi, I recently created a website in ASP.NET and it looks great in IE but in Netscape there is a strange dark blue background behind all the asp:tables. Since I set the background for these tables...
2
by: Vik | last post by:
1. In IE 6.0, I can open a Web page http://localhost/MySite/MyPage.aspx, which connects to an SQL Server without asking for log in. In Netscape 7.1, the page requires log in. Provided the Windows...
1
by: kevin.a.sweeney | last post by:
I would like to open an application from a hyperlink on a webpage. 1. the webpage is located on my local machine. 2. the application is located on my local machine. 3. the application will run...
9
by: Tuy Solang | last post by:
I download four scripts that are used to display Khmer PGN for Khmer Chess. It works fine with Netscape 7.1 on MS Millenium, but it gave me an error(Java Script console) with Netscape 8.1 on MS...
10
by: jodleren | last post by:
Hi I know, that there are a lot of people having problems with orkut.com, errors like "object expected" and named objects missing. When loading the site can generate some 10 errors, and still...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.