/    Sign up×
Community /Pin to ProfileBookmark

Javascript OK in IE 6 but not in Netscape

Hello

I have a problem with Javascript on a Web page. Although the script (which just drops some other animated text onto the page) works fine when viewed with Internet Explorer the script doesn’t appear to work with Netscape (or running Mozilla under Linux). Javascripts are enabled in all my browsers and other web pages with scripts look ok.
The script is contained in the header of my page as opposed to a file and in called like so:
<body onload=”dynAnimation8()”>
The actual page is at [url]www.antzpantz.co.uk[/url]

Grateful for any helpful suggestions

Thanks

Alan

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@scottieoatsJul 10.2004 — If you open the Javascript console in Netscape 6+, you will see the errors:

Error: document.layers has no properties

Source File: http://www.antzpantz.co.uk/

Line: 37

document.layers only works in versions of Netscape prior to 6 (ie Netscape 4.x)

It would be an idea to check out some info on building cross browser DHTML libraries...can't think of any site off the top of my head...but basically you should be looking to make your scripting DOM compliant and avoiding the document.layers and document.all objects.
Copy linkTweet thisAlerts:
@andyshepJul 10.2004 — i had a look at your site

and could not see why it wouldnt work then i had a look in

O'REILLYS JAVASCRIPT THE DEFINITIVE GUIDE

and i found this

THE LAYER API WAS PROPOSED TO THE W3C FOR STANDARDIZATION BUT WAS NEVER STANDARDIZED.FOR THIS REASON,IT HAS BEEN DROPPED BY THE MOZILLA PROJECT AND IS NOT SUPPORTED IN MOZILLA OR NETSCAPE 6.THUS THE TECHNIQUES ARE ONLY USEFUL TO THE NETSCAPE 4X SERIES OF BROWSERS FROM NETSCAPE.

refering to this line

function dynAnimation8()

{

var ms = navigator.appVersion.indexOf("MSIE");

ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4);

if(!ie4)

{

if((navigator.appName == "Netscape") &&

(parseInt(navigator.appVersion.substring(0, 1)) >= 4))

{

for (index=[COLOR=red]document.layers.[/COLOR]length-1; index >= 0; index--)

{

layer=document.layers[index];

if (layer.left==10000)

layer.left=0;

}

}

return;

}


hope this helped

andy
Copy linkTweet thisAlerts:
@CookieBauthorJul 10.2004 — That certainly does help me a lot. I suspected that this browser sniffing bit had something to do with the problem but would never have got to that. This was a script I got from AceHTML.

Thanks
×

Success!

Help @CookieB spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...