176
rated 0 times
[
182]
[
6]
/ answers: 1 / hits: 25267
/ 12 Years ago, tue, june 26, 2012, 12:00:00
I have three images: the first is a light switch, the second is an off light bulb and the third is an on light bulb. When a user clicks on the light switch image, I would like it to change the off light bulb image into the on light bulb image. Is this possible?
These are the images:
Javascript:
img2=new Image();
img2.src=images/RCS/lightbul2-250.gif;
img3=new Image();
img3.src=images/RCS/lightbuld1.gif;
function changeImage() {
document.getElementById('myImage').src=img2.src;
}
function changeImage2() {
document.getElementById('myImage').src=img3.src;
}
HTML:
<img id=myImage onmouseover=changeImage() onmouseout=changeImage2() border=0 width=250 height=141 src=images/RCS/lightbulb1-100.gif>
More From » html