Skip to content

Instantly share code, notes, and snippets.

@LeoDT
Created November 9, 2011 08:20
Show Gist options
  • Save LeoDT/1350823 to your computer and use it in GitHub Desktop.
Save LeoDT/1350823 to your computer and use it in GitHub Desktop.
replaceImgSrc
function replaceImgSrc(id){
var imgs = document.getElementById(id).getElementsByTagName("img");
for(var i=0;i<img.length;i++){
imgs[i].src = qualifyURL(imgs[i].src);
}
}
function qualifyURL(url){
var img = document.createElement('img');
img.src = url;
url = img.src;
img.removeAttribute("src");
return url;
}
replaceSrc("data");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment