????
Current Path : /home2/morganrand/backup.morganrand.com/0tools/js/ |
Current File : /home2/morganrand/backup.morganrand.com/0tools/js/add-captions.js |
// JavaScript Document function captionizeImages() { if (!document.getElementsByTagName) return false; if (!document.createElement) return false; var images = document.getElementsByTagName("img"); if (images.length < 1) return false; for (var i=0; i<images.length; i++) { if (images[i].className.indexOf("captioned") != -1) { var title = images[i].getAttribute("title"); var divCaption = document.createElement("div"); divCaption.className = "caption"; var divCaption_text = document.createTextNode(title); divCaption.appendChild(divCaption_text); var divContainer = document.createElement("div"); divContainer.className="imgcontainer"; images[i].parentNode.insertBefore(divContainer,images[i]); divContainer.appendChild(images[i]); insertAfter(divCaption,images[i]); } } }