I'm trying to get the src of any image through plain JavaScript on mouseover.
// Retrieve image URL.
document.getElementsByTagName('img').onmouseover = getURL();
function getURL() {
var URL = this.getAttribute('src');
}
I can't bind any of these images to an ID and just getElementById. I have to get any image without modifying the DOM and without jQuery. Looks like getElementsByTagName gets you an array. How would I make this function work? Thanks.