sup y'all.
i'm trying to write a script that'll add to the paths of all the img tags on a page...
in other words,would turn intoHTML Code:<img src="images/someImage.gif" alt="" border="0" />it's the "../" that needs to be added.HTML Code:<img src="../images/someImage.gif" alt="" border="0" />
here's what i have so far. works in FF but no dice in IE7:
Code:function findImages(){ var img_tag = document.getElementsByTagName('img'); var every_image = img_tag[0]; var img_src = every_image.getAttribute("src"); for (var i=0;i<img_tag.length;i++) { img_src = img_tag[i].getAttribute("src"); img_tag[i].src = img_src.replace(/^images\/+/i, "../images/"); } }



Reply With Quote



Bookmarks