Link to home
Start Free TrialLog in
Avatar of GaryZ
GaryZ

asked on

Broken img link in Netscape 3.0

I am getting a broken image link on a page in Netscape 3.0 only, works fine in 4.0 of IE and Netscpae. I have run the code thru a validator with no errors showing.

Need help on this one
Avatar of GaryZ
GaryZ

ASKER

GaryZ,

I believe that the problem is one of the known bugs in Netscape 3.  I think that (and I can't be 100% sure about this as my workaround has failed) we are dealing with multiple reflection here.

The bug is where Netscape 3 reflects a Javascript object multiple times when it is in a nested table.  Your images after adding a debug alert of:

alert(imgDocID.length);

inside your hilite function show that the images length is being reported as 4.  Now your page uses a single nested table and so this reflection should be only once and therefore the length value should be 2, but its 4.

I have a workaround but that workaround doesn't appear to work. And having just tested the workaround in its own code it doesn't work there either (thanks Netscape for the useless fix!!).

The workaround is this:
<!--

 Navigator 3.0X

Images in table cells are reflected into JavaScript twice.
(Or four times if nested in a two-level table, etc.)

     Workaround: use the array that results from multiple reflection in JS, as in this example based on
     Bram Cohen's (bram@earthweb.com) test case:


//-->

        <html>
        <title>Nested Tables with img src Change Bug</title>
                                                <head>
                                                </head>
        <body>
        <table width="100%" height="100%">
        <tr><td align=center valign=middle>
        <table><tr><td><img name="myImage" src="first.gif"></td></tr></table></td></tr>
        </table>
        <script>
        with (document) {
            if (myImage.length){
                myImage[myImage.length-1].src = "second.gif";
            } else {
                myImage.src = "second.gif";
            }
        }
        </script>
        </body>
        </html>

Everything appears to work okay, but if you put in a couple of debug alerts to see which part of the if...else condition gets executed you find out that it is the else, meaning that the reflection doesn't happen, but it should have because the image is within a nested table.

Now your page is giving a very difinate reflection, try this in your page and you'll see what I mean:

function hiLite(imgDocID,imgObjName) {
  if (document.images) {
     alert(imgDocID.length);
     document.images[imgDocID].src = eval(imgObjName + ".src");
  }
}

Now here is where I am stumped because the bug is in my opinion not solvable.  The image you get in your page which is broken is definately an instance of reflection because right-clicking on it does provide an image options like view, save etc.

I think the best thing would be to rewrite the page to have no nested tables.

Sorry I can;t help further.  I'll be interested to see if anyone else has a solution to this.

Trevor.


GaryZ,

Please read the 3rd from last paragraph as:

Now here is where I am stumped because the bug is in my opinion not solvable.  The image you get in your page which is broken is definately an instance of reflection because right-clicking on it does   NOT   provide an image options like view, save etc.

Sorry.

Trevor.


ASKER CERTIFIED SOLUTION
Avatar of sybe
sybe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sybe,

Well, I don't know.  Trying to find something more complicated than was actually the case.  Hey who would have thought a missing image was a 300 pointer? Suppose that's why I was looking deeper.

>> "Your HTML code is not the reason, and there is no bug in NS3."

NS3 does have a bug with nested tables (a well known bug).


Trevor.


Avatar of GaryZ

ASKER

Boy did I miss that one. It has had me bugged for 2 weeks. I thought it was having a problem with white.gif

Thanks a lot.
Avatar of GaryZ

ASKER

The reason it was worth 300 was I needed an answer NOW :-)

I have to have the site up tomorrow.