PDA

View Full Version : mouseover limitations


Wram
11-21-2002, 03:32 AM
What I am trying to do is this...

on a mouseover event in a text link, I am swapping a transparent image in another area of the document, for a picture of the product indicated by the text link. I also want to have a text description (a variable), appear beside the image, (I don't want to use another image). I have tried it using a <textarea> as the target and this doesn't seem to work... at least not for me.

What am I missing?

All suggestions will be greatly appreciated.
Thanks,

Wram

chrismiceli
11-21-2002, 03:38 AM
you could make the onMouseOver do a function which changes the source of the transparent image and writes a the variable in a table cell next to the image, here would be the function.

function swap() {
document.images['imagename'].src = whatever.jpg;
document.getElementsById("id").writeln(variable);
}

glenngv
11-21-2002, 03:58 AM
function showInfo(imgSrc,desc){
document.getElementById("info").innerHTML = '<img src="' + imgSrc + '"><br>' + desc;
}

function hideInfo(){
document.getElementById("info").innerHTML='';
}
then you'd call it like this:

<a href="page1.htm" onmouseover="showInfo('image1.jpg','This is image 1')" onmouseout="hideInfo()">Page 1</a><br>
<a href="page2.htm" onmouseover="showInfo('image2.jpg','This is image 2')" onmouseout="hideInfo()">Page 2</a>

<div id="info">
<!--Link info will go here-->
</div>

you may want to preload the images so that the images will show quickly. there are many preload images script out there, you can google it.

Wram
11-21-2002, 03:08 PM
Very kew1 and much appreciated fellas! Now maybe my hair will grow back.

Tks,

Wram