Closed Bug 66855 Opened 25 years ago Closed 24 years ago

Can't open menus in left frame

Categories

(Tech Evangelism Graveyard :: English US, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: db, Assigned: evangelism)

References

()

Details

There is a menu in the left frame that don't work. In other browsers like ns 4.75 the items are exapanded so you can choose in the menu. For example the line which says CD-ROM/DVD should have two indented lines under it like: CD-ROM/DVD CD-ROM DVD-ROM But in mozilla these don't show up I'm using 2001012611 underl linux. And with the java-package that came with netscape 6, java 2 Runtime Environment 1.3.0_01 according to the readme. But meybe that has nothing to do with JavaScript? The menu uses JavaScript so I just guess it's a JavaScript error.
Bad Javascript : it uses document.all Over to evangelism
Status: UNCONFIRMED → NEW
Component: Javascript Engine → Evangelism
Ever confirmed: true
Setting default owner and QA ("Reassign bug to owner fo selected component")
Assignee: rogerl → evangelism
QA Contact: pschwartau → zach
Here is an example of the HTML, from http://www.datorbutiken.com/p/menydept.htm <HTML> <HEAD> <LINK REL="STYLESHEET" HREF="../static/nav.css" TYPE="text/css"> <STYLE TYPE="text/javascript"> classes.child.ALL.display = "block" </STYLE> <SCRIPT LANGUAGE="JavaScript" ID="code"> function swapDisplay() { // Make sure a child element exists var child = event.srcElement.getAttribute("child"); if (null!=child) { var el = document.all[child] if (null!=el) el.style.display = ""==el.style.display ? "block" : "" } } function showAll() { var child = s853; if (null!=s853) child.style.display = ""==child.style.display ? "block" : "" } document.onclick = swapDisplay; </SCRIPT> </HEAD> <BODY onLoad='showAll();'> <!-- _ShopIT_LINKS_BEGIN_ --> <NOBR><IMG SRC="../g/ra.gif">&nbsp;<A CLASS="parent" NAME="m853" CHILD="s853">Datorer & Tillbehör</A></NOBR><BR> <DIV ID="s853" CLASS="child"> <NOBR><IMG SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<A TARGET="m" HREF="9037.htm">Fyndhörnan</A></NOBR><BR> <NOBR><IMG SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<A TARGET="n" HREF="menuconfig.htm" onClick='top.m.location="../info/config.htm";'>Bygg din egen Dator</A></NOBR><BR> <NOBR><IMG SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<A TARGET="n" HREF="menu856.htm" onClick='top.m.location="../info/856.htm";'>Hårdvara</A></NOBR><BR> <NOBR><IMG SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<A TARGET="n" HREF="menu857.htm" onClick='top.m.location="../info/857.htm";'>Mjukvara</A></NOBR><BR> </DIV> <NOBR><IMG SRC="../g/rb.gif">&nbsp;<A CLASS="parent" TARGET="n" HREF="menu854.htm" onClick='top.m.location="../info/854.htm";'>DVD-filmer</A></NOBR><BR> <!-- _ShopIT_LINKS_END_ --> </BODY> </HTML>
I don't think the problem is the use of "all". It seems to be a CSS thing, not document.all? I don't know CSS very well... A definite problem is this function above: function showAll() { var child = s853; if (null!=s853) child.style.display = ""==child.style.display ? "block" : "" } The line "var child = s853;" produces an error in the NN4.7 JavaScript console: JavaScript Error: http://www.datorbutiken.com/p/menydept.htm, line 19: s853 is not defined. However, NN4.7 goes on to render the page anyway. Mozilla/N6 has the same error, but it doesn't continue to render because of the way JavaScript 1.5 binds (as opposed to JavaScript 1.4 used in NN4.7). Mozilla differs from NN4.7 and earlier because it catches syntax errors before binding functions, or even compiling code for them. This is within the ECMA3 spec (ECMA-262). Any syntax error causes execution to stop. Because of the ECMA3 standard, any malformed syntax means we can't generate code, because we generate the code from a complete parse tree. I believe that is part of what is going on here -
Here is another frame with a menu that don't work and that dont have any showAll function: http://www.datorbutiken.com/p/menu856.htm If someone can point out how that code should look like to work in mozilla I could contact the shop and try to get them to change. But I'd prefer to know whats wrong and how to fix it before. I know a lot of languages including C++ but I don't know java(script). I tried some random fixes, for example, it looks like the event handling is different in mozilla then what the site wants (variable event is unknown, I guessed that maybe the function should take the event as an argument, but I didn't get it to work). I simply don't know javascript so I can make a quick fix myself. Here is the frame from the link above (the interesting part at least): <html> <head> <link REL="STYLESHEET" HREF="../static/nav.css" TYPE="text/css"> <style TYPE="text/javascript"> classes.child.ALL.display = "block" </style> <script LANGUAGE="JavaScript" ID="code"> <!-- function swapDisplay() { // Make sure a child element exists var child = event.srcElement.getAttribute("child"); if (null!=child) { var el = document.all[child] if (null!=el) el.style.display = ""==el.style.display ? "block" : "" } } document.onclick = swapDisplay; // --> </script> </head> <body> <!-- _ShopIT_LINKS_BEGIN_ --> <nobr><img SRC="../g/rb.gif">&nbsp;<a CLASS="parent" TARGET="m" HREF="../info/856.htm">Om Hårdvara</a></nobr><br><br> <nobr><img SRC="../g/rb.gif">&nbsp;<a CLASS="parent" TARGET="m" HREF="9080.htm">Backup</a></nobr><br> <nobr><img SRC="../g/rb.gif">&nbsp;<a CLASS="parent" TARGET="m" HREF="9036.htm">Barebone-system</a></nobr><br> <nobr><img SRC="../g/ra.gif">&nbsp;<a CLASS="parent" NAME="m9092" CHILD="s9092">Bärbart/Notebook</a></nobr><br> <div ID="s9092" CLASS="child"> <nobr><img SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<a TARGET="m" HREF="9038.htm">ACER</a></nobr><br> <nobr><img SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<a TARGET="m" HREF="9039.htm">ASUS</a></nobr><br> <nobr><img SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<a TARGET="m" HREF="9040.htm">IBM</a></nobr><br> <nobr><img SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<a TARGET="m" HREF="9041.htm">HP</a></nobr><br> <nobr><img SRC="../g/rb.gif">&nbsp;&nbsp;&nbsp;<a TARGET="m" HREF="9042.htm">Toshiba</a></nobr><br> </div> <nobr><img SRC="../g/rb.gif">&nbsp;<a CLASS="parent" TARGET="m" HREF="9057.htm">CD-brännare</a></nobr><br> <nobr><img SRC="../g/ra.gif">&nbsp;<a CLASS="parent" NAME="m9055" CHILD="s9055">CD-ROM/DVD</a></nobr><br> ....
Reporter document.all is not supported by Mozilla because it's not W3C. Also the use of, let me see, scroll scroll, you know what, I will copy that javascript and change it a bit here to make it clear. function swapDisplay (evt) { var el = null; var child = null; if (document.all) child = event.srcElement.getAttribute("child"); else child = evt.target.parentNode; if ( null != child ) { if ( document.all ) el = document.all[ child ]; else el = child; el.style.display = "" == el.style.display ? "block" : ""; } return; } This comments window is way to tall to input this, but, give it a run!
I changed it to function swapDisplay (evt) { var el = null; var child = null; if (document.all) child = event.srcElement.getAttribute("child"); else child = evt.target.parentNode.getAttribute("child"); if ( null != child ) { if ( document.all ) el = document.all[ child ]; else el = document.getElementById(child); el.style.display = "" == el.style.display ? "block" : ""; } return; } and then it seems to be working. But I have no idea if this works with "every" old browser also. It's no use trying to get the site to change if it means that browsers like IE 4 stops working, but at least I know how to get it sort of working now.
That should it be, but please change "document.onclick = swapDisplay;" into "if ( !document.layers ) document.onclick = newSwapDisplay;" This to suppress a javascript warning in Netscape 4.x Ok!
And with "newSwapDisplay" I mean your version OK?
Tänk på att ha Java och JavaScript aktiverat i Din webläsare för att shoppingsystemet ska fungera. 'webläsare' I like that LOL
For guidance on W3 standards and the differences between Navigator 4.x and Mozilla, see http://sites.netscape.net/ekrock/standards.html
Summary: Can't open menues in left frame → Can't open menus in left frame
After a couple of complaints to the site they have now changed it so it works in mozilla.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
the url has changed, but verif
Status: RESOLVED → VERIFIED
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
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.