when hovering over an image, how can I make two or more images change?

戏子无情 提交于 2019-12-25 03:24:34

问题


I was wondering if you can tell me how I can do the following: when hovering over an image, two or more images change.

Im kind of new at this, so please give me clear directions


回答1:


Adapt this example to suit.

var image1 = document.getElementById('image1'),
    image2 = document.getElementById('image2'),
    image3 = document.getElementById('image3');

image1.onmouseover = function() {
   image2.src = 'whatever.jpg';
   image3.src = 'something.png';
}


来源:https://stackoverflow.com/questions/6328580/when-hovering-over-an-image-how-can-i-make-two-or-more-images-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!