After a bit of frustration at the front page of OSMusic.Net having red X images, I decided to write something that will check for bad and broken images and remove them altogether from the display. It's a drity hack, but it works rather well.
function checkImages() {
var all = document.all ? document.all : document.getElementsByTagName('*');
for (var i = 0; i < all.length; i++)
{
if (all[i].tagName == "IMG")
{
if (all[i].complete == false)
{
all[i].style.visibility = "hidden";
all[i].style.display = "none";
}
}
}
}
<body onload="checkImages();">
Labels: Coding, JavaScript, OSMusic.Net
0 Comments
|