Java Script is messing up.

Vidyut Luther (vluther@doconline.com)
Fri, 27 Feb 1998 09:41:55 -0500 (EST)


Date: Fri, 27 Feb 1998 09:41:55 -0500 (EST)
From: Vidyut Luther <vluther@doconline.com>
To: W3 HTML Mailing list <www-html@w3.org>
Message-ID: <Pine.BSF.3.96.980227092513.12037B-100000@ifu.ifu.net>
Subject: Java Script is messing up.

Hi, 
 My question is regarding JavaScript and it's compatibility with browsers.

I am working on a web page, and this is my first attempt at javascript,
I'm attempting to do mouse overs, but i've been getting some wierd errors,
when the page is viewed by different browsers.

I designed the page using communicator 4.03 as the preview browser and
notepad as the editor. anyway here is the source for the javascript and
then i'll try and explain what it's supposed to do, and what the error
messages are.

<HTML>
<HEAD>

<SCRIPT language="javascript">
function buttonSwap(idx, newImage)
{document.images[idx].src = newImage;}
</SCRIPT>
<TITLE> Doc Online </TITLE>
<BODY >
<TABLE>
<TR>
<td  colspan=2><CENTER>
<A HREF="news/index.html" onMouseOver="buttonSwap(1,&quot;newsbot.gif&quot;)" onMouseOut="buttonSwap(1, &quot;newsup.gif&quot;)">
<IMG SRC="newsup.gif" BORDER=0></A></CENTER>
</TD></TR>
</TABLE>
</BODY>
</HTML>
if you see the code, you'll realize that it's a simple onmouseover, and
onmouse out function.  it works great in communicator 4.03. But when i
tried to view it using IE 3.01, i got a javascript error, it said
something about image can't be used as an array, and the same thing using
netscape 2.02.  

But, when it's viewed through netscape 3.0, the whole page loads up fine
and dandy, but once the mouse goes over any of the images on the table,
another image is loaded up, but not right over the old image, it seems the
new image is loaded a few pixels over the original image.  I can't figure
out why this is happening. can anyone help ?

to see the whole page and it's whole cde point your browsers at
 
http://www.doconline.com
any help on this would be greatly apreciated


Vidyut Luther 
http://www.doconline.com
E-Mail:vluther@doconline.com