I have been asked to make a change to our website (it uses asp [about which I know nothing]), a solution based on css and javascript would be easier for me.
Is it possible to have a graphic on the webpage change when the user moves the cursor over a certain <li> item, eg.
- option 1
- option 2
- option 3
When the mouse is moved over option 1 it will result in a certain picture being shewn, another for option 2 and a different one again for option 3.
Given the following HTML:
And the JavaScript:
This is certainly possible.
If you want to amend this so that each
litriggers a specific image to appear, then you can cause that using the following, or something similar:To use an array of image sources, it’s possible to use:
JS Fiddle demo.
And, finally, to leave the replaced image on the page (rather than replacing the original source of the image onmouseout), simply remove the
onmouseoutfunction:JS Fiddle demo.