简体   繁体   中英

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

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

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';
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM