Closed Thread Icon

Preserved Topic: problem with javascript on netscape4.78 Pages that link to <a href="https://ozoneasylum.com/backlink?for=18506" title="Pages that link to Preserved Topic: problem with javascript on netscape4.78" rel="nofollow" >Preserved Topic: problem with javascript on netscape4.78\

 
Author Thread
wr22
Obsessive-Compulsive (I) Inmate

From:
Insane since: Sep 2001

posted posted 09-15-2001 10:36

Hi all,

I've got a small javascript problem.
In the following piece of code:

code:
<HTML>
<HEAD>
<style type="text/css">
table.next { position: absolute; top:15px; left: 120px; }
</style>
</HEAD>

<BODY>
<table>
<tr><td><img name="img1" src="image1.gif"></td></tr>
<tr><td><img name="img2" src="image2.gif"></td></tr>
</table>
<table class="next">
<tr><td><img name="img3" src="image3.gif"></td></tr>
<tr><td><img name="img4" src="image4.gif"></td></tr>
</table>

<script language="JavaScript" type="text/javascript">
alert( "test" );
alert( "img3 defined? " + document.images['img3'].src );
</script>

</BODY>
</HTML>



the second alert msg doesn't show up on Netscape4.78 (It does work on IE and Netscape6)
Somehow img3 doesn't get defined.
If I remove the 'class="next"' part of the 2nd table declaration, everything works well.
Has anyone seen anything like this? Is this a well-known netscape4.78 bug?
Is there a work-around or something?
I appreciate your help.

Thanx in advance.

-wr22

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 09-15-2001 14:54

Shitscape will treat your second table as layer and therefore won't be able to access images in it by using only document.images... Anyway, to make it work modify second <table> tag to look like this:

<table class="next" id="next">

And use the following JS code:

alert( "img3 defined? " + (document.layers ? document.layers['next'].document.images['img3'].src : document.images['img3'].src) );

Enjoy!

Osaires
Paranoid (IV) Inmate

From: oslo, Norway
Insane since: Aug 2001

posted posted 09-15-2001 15:15

welcome wr22

wr22
Obsessive-Compulsive (I) Inmate

From:
Insane since: Sep 2001

posted posted 09-15-2001 21:57

I knew I would get an answer here...
Thank you, mr.maX and Osaires

-wr22

« BackwardsOnwards »

Show Forum Drop Down Menu