What I have right now is this, and I'd like to use less code to do the same function. How would I achieve the same output with less lines of code?
// img 1 hover
var image = document.getElementById("rImg");
image.addEventListener('mouseover', function(){
image.src = "images/blackback.png"
})
image.addEventListener('mouseout', function(){
image.src = "images/blackfront.png"
})
// img 2 hover
var img2 = document.getElementById("rMImg");
img2.addEventListener('mouseover', function(){
img2.src = "images/greyback.png"
})
img2.addEventListener('mouseout', function(){
img2.src = "images/greyfront.png"
})
// img 3 hover
var img3 = document.getElementById("lMImg");
img3.addEventListener('mouseover', function(){
img4.src = "images/navyback.png"
})
img3.addEventListener('mouseout', function(){
img3.src = "images/navyront.png"
})
img:hoverin CSS?