HTML and JavaScript HotSpot Rollover
I have been working on a fun little project the last couple days. It involves 1 image with a couple hot spots that change the image depending on which hotspot the user hovers over.
Here is the one I made. (hehehehe…yes, immature I know… but i think this is a hilarious little prank)
I had to make a rollover function with javascript. You can put this code in the script section of the header, or in a separate script that you reference.
function flip(oldpic,newpic) {
oldpic.src = newpic;
}
All this function does is change the source of an image based on the name of the image.
In the Html section of your page you call it like this:
onmouseout="flip(ImageName,'Original.jpg')"
onmouseover="flip(ImageName,'New.jpg')"
You can view the full source of the example and get crackin’ on your own little prank. Happy hunting 🙂
Or if you want to prank someone – This is the one I send people to, it has a different link that does not bring you back to this page. – http://spilt.tech/home