Article View: aus.computers.java
Article #1230Whats wrong with this code...?
From: VanCezanne
Date: Sat, 08 May 1999 00:00
Date: Sat, 08 May 1999 00:00
209 lines
5527 bytes
5527 bytes
Hi, I cut, pasted, and slightly altered some java code from
http://www.htmlgoodies.com/beyond/dualflip.html
which does the mouseover-change-remote-image thing. The java works,
but my Netscape stand alone 4.08 has a javascript error message in the
status bar.
This is what the page looks like......
http://www.villagehost.com/temp/new/altered_multi5.htm
Below is both the orginal code and my altered version.
Can you see what i'm doing wrong?
Thanks! :)
ORIGINAL CODE:
================
<SCRIPT LANGUAGE="JavaScript">
//This script changes the graphic on mouse over and a graphic in
//another part of the screen
{
alt0 = new Image();
alt0.src = "white.gif";
alt1 = new Image();
alt1.src = "hg_banner.gif";
alt2 = new Image();
alt2.src = "jg_banner.gif";
graphic1= new Image();
graphic1.src = "but1.gif";
graphic1on = new Image();
graphic1on.src = "but1b.gif";
graphic2= new Image();
graphic2.src = "but2.gif";
graphic2on = new Image();
graphic2on.src = "but2b.gif";
}
function imageChange(imageID,imageName,imageID2,imageName2) {
{
document.images[imageID].src = eval(imageName + ".src");
document.images[imageID2].src = eval(imageName2 + ".src");
}
}
</script>
<center>
<TABLE border="0">
<TR>
<TD>
<A HREF="/"
ONMOUSEOVER="imageChange('global','alt1','one','graphic1on')"
ONMOUSEOUT="imageChange('global','alt0','one','graphic1')">
<IMG SRC="but1.gif" BORDER="0" NAME="one"></A><BR><BR>
<A HREF="http://www.javagoodies.com"
ONMOUSEOVER="imageChange('global','alt2','two','graphic2on')"
ONMOUSEOUT="imageChange('global','alt0','two','graphic2')">
<IMG SRC="but2.gif" BORDER="0" NAME="two"></A>
</TD>
<TD>
<IMG SRC="white.gif" WIDTH="130" HEIGHT="130" NAME="global" >
</TD>
</TR>
</TABLE>
============
MY ALTERED VERSION
============
<script language="JavaScript">
//This script changes the graphic on mouse over and a graphic in
//another part of the screen
{
alt0 = new Image();
alt0.src = "circle_welcome.gif";
alt1 = new Image();
alt1.src = "circle_clients.gif";
alt2 = new Image();
alt2.src = "circle_prices.gif";
alt3 = new Image();
alt3.src = "circle_styles.gif";
alt4 = new Image();
alt4.src = "circle_contact.gif";
graphic1= new Image();
graphic1.src = "3a.gif";
graphic1on = new Image();
graphic1on.src = "3a2.gif";
graphic2= new Image();
graphic2.src = "3b.gif";
graphic2on = new Image();
graphic2on.src = "3b2.gif";
graphic3= new Image();
graphic3.src = "3c.gif";
graphic3on = new Image();
graphic3on.src = "3c2.gif";
graphic4= new Image();
graphic4.src = "3d.gif";
graphic4on = new Image();
graphic4on.src = "3d2.gif";
}
function
imageChange(imageID,imageName,imageID2,imageName2,imageID3,imageName3,imageID4,imageName4)
{
{
document.images[imageID].src = eval(imageName + ".src");
document.images[imageID2].src = eval(imageName2 + ".src");
document.images[imageID3].src = eval(imageName3 + ".src");
document.images[imageID4].src = eval(imageName4 + ".src");
}
}
</script>
</head>
<body background=beige4.gif>
<center>
<table border="0" cellpadding=0 cellspacing=0>
<tr align=center>
<td>
<img src="1.gif" width=246 height=90 border=0>
</td>
</tr>
<tr align=center>
<td>
<img src="2.gif" width=315 height=24 border=0>
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding=0 cellspacing=0>
<tr>
<td>
<a href="clients.htm"
onmouseover="imageChange('global','alt1','one','graphic1on')"
onmouseout="imageChange('global','alt0','one','graphic1')">
<img src="3a.gif" border="0" name="one"></a></td><td>
<a href="prices.htm"
onmouseover="imageChange('global','alt2','two','graphic2on')"
onmouseout="imageChange('global','alt0','two','graphic2')">
<img src="3b.gif" border="0" name="two"></a></td><td>
<a href="styles.htm"
onmouseover="imageChange('global','alt3','three','graphic3on')"
onmouseout="imageChange('global','alt0','three','graphic3')">
<img src="3c.gif" border="0" name="three"></a></td><td>
<a href="contact.htm"
onmouseover="imageChange('global','alt4','four','graphic4on')"
onmouseout="imageChange('global','alt0','four','graphic4')">
<img src="3d.gif" border="0" name="four"></a>
</td>
</tr>
</table>
</td>
</tr>
<tr align=center>
<td>
<br>
<img src="circle_welcome.gif" width=129 height=128 name="global" >
</td>
</tr>
</table>
<br>
<table>
<tr>
<td>
<font size="-2" face="Arial">
<strong><a href="kdjd.htm"><font color="#C00000">C l i e n t
s</font></a></strong> <font color="#844E1A">||</font>
<strong><a href="kdjd.htm"><font color="#C00000">P r i c e
s</font></a></strong> <font color="#844E1A">||</font>
<strong><a href="kdjd.htm"><font color="#C00000">S t y l e
s</font></a></strong> <font color="#844E1A">||</font>
<strong><a href="kdjd.htm"><font color="#C00000">C o n t a c t
U s</font></a></strong>
</font>
</td>
</tr>
</table>
Technical Details
Message-ID:
<373396d7.157693830@news.acsworld.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,26f0187e868a3d4f,start X-Google-Attributes: gid10d6db,public From: my_email_address_is_mulvidon@hotmail.com (VanCezanne) Subject: Whats wrong with this code...? Date: 1999/05/08 Message-ID: <373396d7.157693830@news.acsworld.net> X-Deja-AN: 475341308 X-Complaints-To: newsabuse@remarQ.com X-Trace: 926117956.795.43 Q0U9Z7HWAB3F9D140C usenet1.supernews.com Organization: Posted via RemarQ Communities, Inc. NNTP-Posting-Date: Fri, 07 May 1999 22:59:16 GMT Newsgroups: aus.computers.java