Closed Bug 62316 Opened 24 years ago Closed 23 years ago

Javascript worked in NS4, doesnt work in NS6

Categories

(Tech Evangelism Graveyard :: English US, defect, P3)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: hein.vaneeden, Assigned: doronr)

References

()

Details

(Whiteboard: [TOOL][HIERMENU])

Have a Javascript1.2 script that gets executed correctly by Netscape Navigator
4.08 perfectly, but it doesnt get executed by NS6.

There are also no Javascript errors when running "javascript:"
JavaScript error:
http://butterfly.is.co.za/Butterfly/ContentDisplay/scripts/hierMenus.js line
813: isFrames is not defined

On mouseover menuitems i get this error:
JavaScript error:
http://butterfly.is.co.za/Butterfly/ContentDisplay/scripts/hierMenus.js line
444: isLoaded is not defined

On mouseout i get this:
JavaScript error:
http://butterfly.is.co.za/Butterfly/ContentDisplay/scripts/hierMenus.js line
712: isLoaded is not defined


linux 2000120621
To see javascript errors go to Tasks->Tools->Javascript console.

The problem with this page is the browser sniffer page which is

    NS4 = (document.layers);
    IE4 = (document.all);
    ver4 = (NS4 || IE4);
    IE5 = (IE4 && navigator.appVersion.indexOf("5.")!=-1);
    isMac = (navigator.appVersion.indexOf("Mac") != -1);
    isMenu = (NS4 || (IE4 && !isMac) || (IE5 && isMac));

none of NS4, IE4 or IE5 will get set by Mozilla, and so isMenu will be false.

As far as I can see isFrames only gets set if isMenu is true.
If isMenu is false the heirMenu.js should not be included.
However, hierMenu.js is included.
The problem is that the following code is used to add the script file:

<script>
<!-- if (isMenu)
{
... Add hierMenu.js
}
//-->
</script>

If 'if (isMenu)' is after '<!--' and on the same line it is not processed
correctly, but if it is on a new line, then it is processed correctly.

IE5 and Netscape 4.75 handle this in exactly the same way, so maybe the
behaviour is correct, and the web site is incorrect.

Reporter, please verify that your javascript is ECMAscript compliant, and don't 
forget that an old browser sniffing will not recognize Mozilla's user agent. 
Javascript is the base of Mozilla, so it does work, that you can be sure. Your 
code has to be invalid somewhere.
Thank you,
Fabian. 
Conor is right: the site uses outdated browser sniffing code. Because of this 
the constant "NS4" is false when using N6, and much of the code doesn't execute.


As Conor points out, because NS4 is false, isMenu is false, and as a 
consequence the constant isFrames never gets defined. That occurs 
in the following part of the given URL:


if (isMenu) {
  menuVersion = 3;
  menuWidth = 120;
      etc.
      etc.
               
  isFrames = false;    <<<<<<<<<<<<< this is where isFrames gets defined

      etc.
      etc.




Here is another example, from the "hierMenus.js" file:

function popUp(menuName,e){
        if (NS4 && NSresized) startIt();
        if (!isLoaded) return;
        linkEl = (NS4) ? e.target : event.srcElement;
        if (clickStart) linkEl.onclick = popMenu;
        if (!beingCreated && !areCreated) startIt();
        linkEl.menuName = menuName;   
        if (!clickStart) popMenu(e);
}



Because NS4 is false the function StartIt() never gets called here.
But that is one place where the constant "isLoaded" is defined -
This leads to an error on the following line, line 444 in the error 
messages above from the JavaScript console...



Reassigning to the Evangelism component. See bug 50711 for more information
on this subject -
Assignee: rogerl → evangelism
Status: UNCONFIRMED → NEW
Component: Javascript Engine → Evangelism
Ever confirmed: true
QA Contact: pschwartau → zach
Any opionions on this javascript not working as expected in Netscape 4, Mozilla
and IE

<script>
<!-- if (isMenu)
{
... Add hierMenu.js
}
//-->
</script>
But nows the question, where can reporter verify his javascript to be fully
ECMAcompliant? That would be the question of this reporter!
Note, ECMAcompliant JavaScript's are rather complicated, if you do not know
where to look for!

Friendly, HJ.
Reassigning evangelism bugs to bclary@netscape.com.
Assignee: evangelism → bclary
Assignee: bclary → doronr
site seems down atm
I first ran into this bug when our Web designer cut-n-pasted this code into a
page on our site.  This appears to be a pretty common problem.  It stems from
the widely-used javascript hierarchical menus at:

    http://www.webreference.com/dhtml/hiermenus/

It is at the root of this bug, bug 50711, bug 74033, bug 60136 and possibly bug
55374.

It looks like to solve this, we will need to implement at least as much of
Layers as IE does, or define document.all and make sure that the IE version of
hierMenus works.

Is that do-able?  Or is there any other way to solve this other than
evangelizing all of the hundreds of sites that use this?

Please see http://bugzilla.mozilla.org/show_bug.cgi?id=85104 for information
about how to handle hierMenu related issues.
Blocks: 85104
OS: Windows 2000 → All
Hardware: PC → All
Whiteboard: [TOOL][HIERMENU]
All Evangelism Bugs are now in the Product Tech Evangelism. See bug 86997 for
details.
Component: Evangelism → US English
Product: Browser → Tech Evangelism
Version: other → unspecified
since the site has been down  for some time, markign fixed per bc
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
it's dead, jim.
Status: RESOLVED → VERIFIED
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.