• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

Double image swap on mouse-over HELP

Have a look at my new website www.wordsandpeople.com an ERROR MESSAGE appears in the browser screen. How can I correct it? I think it is because of the Java Script code for my double image swaps when the mouse is over any of the images of strawberrys.
0
Kapow
Asked:
Kapow
  • 4
  • 4
  • 2
1 Solution
 
cheekycjCommented:
I looked at the code and I didn't see the function MM_preloadImages('but1_up.jpg','text1.gif','text2.gif','text3.gif','text4.gif') defined anywhere?

CJ
0
 
KapowAuthor Commented:
My code has the following: <body onLoad="MM_preloadImages('but1_up.jpg','text1.gif','text2.gif','text3.gif','text4.gif')" bgcolor="#FFFFFF" text="#183888" link="#183888" vlink="#183888" alink="#183888">
Is that what your talking about? or are you saying that something else is missing???
0
 
cheekycjCommented:
I was just wondering where that function was defined, I didn't see it in the code.

CJ
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
mgfranzCommented:
Look at your OnMouse calls, whats wrong with this line?

onMouseOut="di20('strawb1','but1_dwn.jpg');di20('textBlnk.gif','textBlnk.gif');"  onMouseOver="di20('strawb1','but1_up.jpg');di20('textBlnk.gif','text1.gif');

You are passing two sets of values to di20, try this;

onMouseOut="di20('strawb1','but1_dwn.jpg');"  onMouseOver="di20('strawb1','but1_up.jpg');"
0
 
KapowAuthor Commented:
To mqfranz: I tried it and lost the 2nd image swap.  What should I do to my code so that both images swap on mouse over without an ERROR MESSAGE appearing in the browser?
0
 
mgfranzCommented:
I have fixed your page, but I need you to send me the but1_up.jpg file for verification.  My email is mark.franz@lpl.com.  There were a couple things that needed modifying.

Mark
0
 
mgfranzCommented:
Here ya go Andy!  Let me know if you have any problems;

Mark

<html>
<head>
<title>WordsAndPeople - WebSites for the new Milleneum</title>

<SCRIPT LANGUAGE="JavaScript">
<!--
ImageSrc = new Array ("but1_up.jpg","text1.gif","text2.gif","text3.gif","text4.gif");
ImageList = new Array ();

for (counter in ImageSrc) {
ImageList[counter] = new Image();
ImageList[counter].src =
ImageSrc[counter];
}
// -->
</SCRIPT>

</head>
<body bgcolor="#FFFFFF" text="#183888" link="#183888" vlink="#183888" alink="#183888">
<table width="100%" border="0" cellspacing="3" cellpadding="0" height="100%">
  <tr>
    <td colspan="2">
      <div align="right"><img width="250" height="91" name="Website_logo" alt="Words &amp; People" border="0" src="images/My_Logo.gif"></div>
    </td>
    <td colspan="2">
      <div align="center"><img width="113" height="118" name="internet_site" alt="Web Sites" src="images/PCshort.gif"></div>
    </td>
  </tr>
  <tr>
    <td colspan="4">
      <div align="center"><applet code="RunningText.class" codebase = "html/" width="400" height="50" name="website" alt="Website Creation for the new Millennium">
          <param name=TEXT value="             Website Creation for the new Millennium">
          <param name=FONT value="Helvetica">
          <param name=FONTSTYLE  value=1>
          <param name=FONTSIZE value=20>
          <param name=FGCOLOR  value="000099">
          <param name=BGCOLOR value="ffffff">
          <param name=WIDTH value=600>
          <param name=HEIGHT value=50>
          <param name=SHADOW value=0>
        </applet></div>
    </td>
  </tr>
  <tr>
    <td colspan="4">
      <div align="center"><img name="textBlnk.gif" src="textBlnk.gif" border="0" usemap="#textBlnk.gif"></div>
    </td>
  </tr>
  <tr valign="top">
    <td width="25%">
      <div align="center"><font size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif"><a href="html/sites.html" onMouseOut="di20('strawb1','but1_dwn.jpg');di21('textBlnk.gif','textBlnk.gif');"  onMouseOver="di20('strawb1','but1_up.jpg');di21('textBlnk.gif','text1.gif');" target="_self" ><img name="strawb1" src="but1_dwn.jpg" border="0"><br>
        All About WebSites</a></font></b></font></div>
    </td>
    <td width="25%">
      <div align="center"><font size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif"><a href="http://www.coachinghealth.com/" onMouseOut="di20('strawb2','but1_dwn.jpg');di21('textBlnk.gif','textBlnk.gif');"  onMouseOver="di20('strawb2','but1_up.jpg');di21('textBlnk.gif','text2.gif');" target="_blank" ><img name="strawb2" src="but1_dwn.jpg" border="0"><br>
        Example Site</a></font></b></font></div>
    </td>
    <td width="25%">
      <div align="center"><font size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif"><a href="html/costs.htm" onMouseOut="di20('strawb3','but1_dwn.jpg');di21('textBlnk.gif','textBlnk.gif');"  onMouseOver="di20('strawb3','but1_up.jpg');di21('textBlnk.gif','text3.gif');" target="_self" ><img name="strawb3" src="but1_dwn.jpg" border="0"></a><br>
        <a href="html/costs.htm" target="_self"><font color="#183888">The Cost</font>
        </a> </font></b></font></div>
    </td>
    <td width="25%">
      <div align="center"><font size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif"><a href="html/infoform.htm" onMouseOut="di20('strawb4','but1_dwn.jpg');di21('textBlnk.gif','textBlnk.gif');"  onMouseOver="di20('strawb4','but1_up.jpg');di21('textBlnk.gif','text4.gif');" target="_self" ><img name="strawb4" src="but1_dwn.jpg" border="0"><br>
        Apply or Enquire</a></font></b></font></div>
    </td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="text1.gif" width="1" height="1"></td>
    <td><img src="text2.gif" width="1" height="1"></td>
  </tr>
  <tr>
    <td><img src="text3.gif" width="1" height="1"></td>
    <td><img src="text4.gif" width="1" height="1"></td>
  </tr>
</table>
<p>
  <script language="JavaScript">
<!-- hide this script from non-javascript-enabled browsers

if (document.images) {
strawb1_F1 = new Image(136,44); strawb1_F1.src = "but1_dwn.jpg";
strawb1_F2 = new Image(136,44); strawb1_F2.src = "but1_up.jpg";
textBlnk_F1 = new Image(73,82); textBlnk_F1.src = "textBlnk.gif";
text1 = new Image(10,10); text1.src = "text1.gif";
}

/* Function that swaps images. */

function di20(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

function di21(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */

function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}

// stop hiding -->
</script>
</p>
</body>
</html>
0
 
KapowAuthor Commented:
EXCELLENT !!!
That seems to do it.  I will upload it to my host this weekend and test it once more, and send you those 100 well earned points.

I was hoping to understand how to fix the problem myself. Did you write the code manually or use an authoring tool?
Where do you suggest I start so that I can learn to sort out that kind of problem?

Many thanks - Andy
0
 
KapowAuthor Commented:
Thankyou Mark
www.wordsandpeople.com is now error free. Thankyou

Do you authoring tools you mentioned create Java Script for you or is that all in your head?

0
 
mgfranzCommented:
Oh my.... do I store Javascript in my head?  No, it is mostly just regular scripting, it's knowing the objects and statements that work with JS as well as VBS that I keep upstairs... :-)

Although, there are a few authoring tools that create JS, Adobe ImageReady 2.0 is one that I have seen create JS, as well as DreamWeaver and DrumBeat, the later two are relatively expensive and difficult to learn for the beginner, check out Homesite 4.5 and CoffeCup 8.0 for nice editors.  CoffeeCup includes some nice JS script with the code.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now