0 Replies - 186 Views - Last Post: 11 November 2007 - 10:17 AM

#1 William_Wilson   User is offline

  • lost in compilation
  • member icon

Reputation: 207
  • View blog
  • Posts: 4,812
  • Joined: 23-December 05

Remove all images from selected document

Posted 11 November 2007 - 10:17 AM

Description: Add to your javascript code and call with the document object to remove all imagespass the document to the function to remove all images. Useful for text based forums, to prevent unwanted image tags. Be sure to generate the document first to ensure all tags are picked up.
function __no_image(d)
{
	var all    = d.getElementsByTagName('*');
	var images = [];
	for(var a=0;a<all.length;++a)
	{
		if(all[a].tagName == 'IMG')
			images.push(all[a]);
	}
	for(var i=0;i<images.length;++i)
	{
		images[i].parentNode.removeChild(images[i]);
	}
}


Is This A Good Question/Topic? 0
  • +

Page 1 of 1