PDA

View Full Version : mouseover load new image


roxinafrika
02-07-2007, 02:50 AM
I recently discovered CSS, works great but I still have some questions.

I created an hover-action, the link-picture changes when the mouse hovers over the link.

what I also want is that when the mouse hovers the link, in the right-bottom corner of the page another picture will appear. so at the same time, the picture of the link changes, and another picture loads in the same page.

can anyone help me with that?

thanx very much :confused:

dang
02-07-2007, 08:54 AM
You'll need to use javascript to do that. Are you familiar with javascript?

roxinafrika
02-07-2007, 11:48 PM
I am familiar with javascript, but mostly used css in the script now. is that gonna cost a problem? because I tried it before (with another website) and than the thing didn't work, I thought because I was using javascript and css at the same time...

dang
02-08-2007, 07:05 AM
Nope, not a problem at all. What you have to do is on mouse over of an image, make a call to a javascript function that changes the source of the picture you want to change.

So, something like:

<img src="/path/to/smallimage.jpg" onmouseover="document.image2.src='/path/to/newimage.jpg'">

<img src="/path/to/image.jpg" name="image2">