I'm having trouble with a JavaScript function that is supposed to display an image on hover, but it's only showing the placeholder symbol for missing images. What could be causing this issue?
Here is the code in question:
function createimg()
{
var img = new Image();
img.src='images/imageoverlay.png';
img.id = 'span1';
img.style.zIndex = 10;
img.style.position = 'absolute';
img.style.display='none';
img.style.top = '140px';
img.style.padding='10px';
img.style.left='240px';
img.className ='dynamicSpan';
document.body.appendChild(img);
}
The image file is located in the "images" subdirectory relative to this code file.