Created
November 9, 2011 15:11
-
-
Save redforest/1351716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function replaceImgSrc(id){ | |
var target_hostname = 'www.baidu.com'; | |
var imgs = document.getElementById(id).getElementsByTagName('img'); | |
var my_hostname = window.location.hostname.toString(); | |
for(var i=0; i<imgs.length; i++){ | |
imgs[i].src = imgs[i].src.replace(my_hostname, target_hostname); | |
} | |
} | |
window.onload = function() { | |
replaceImgSrc('data'); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment