Entry
How can onMouseOver/ Out trigger a text description to appear elsewhere on page ?
Aug 17th, 2000 12:36
Alan Frey, Andrew Whyte,
First you need to have a handle on the text element. Personally i prefer
to make an image and use the image tag to handle the name attribute.
ex.
<td align="center"><img name="whatevertext"
src="/images/whatever.gif"
width="600"
></td>
then use the onmouseover/out method to call a javascript function:
<tr>
<td> </td>
<td> </td>
<td align="center"><a href="http://www.faqts.com/"
onmouseover="ac_switch_acws()"
onmouseout="ac_switch_welcome()"><img
name="acsplashstoredef"
src="/images/ac/mainimage.gif"
width="100" height="100" border="0"></a
></td>
<td> </td>
<td> </td>
</tr>
the functions reference the name :
function ac_switch_welcome() {
document.images['whatevertext'].src = acimgarray[0];
}
function ac_switch_acws() {
document.images['whatevertext'].src = acimgarray[1];
}
Note: the images arepreloaded using a simple image array.
the array source code is below:
var maximages = 2;
var acimgarray = new Array(maximage);
acimgarray[0] = "/images/ac/whatever01.gif";
acimgarray[1] = "/images/ac/whatever02.gif";
for (var i = 0; i < maximage; i++) {
eval('pic' + i + ' = new Image();');
eval('pic' + i + '.src = acimgarray[i];');
}