Created
February 5, 2012 03:12
-
-
Save gsdevme/1742307 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
(function(window,document,undefined){ | |
var url,l; | |
el=document.getElementsByClassName('grabHolidayImages'); | |
if(el!=undefined){ | |
l=el.length; | |
for(i=0;i<l;++i){ | |
url = el[i].getAttribute('title'); | |
foo = new ajax(url, (function(html){ | |
var regex=new RegExp('<img src="(.*?)" />', 'g'); | |
console.log(regex.exec(html)[1]); | |
}); | |
} | |
} | |
})(window,document); | |
function ajax(url, callback){ | |
var xmlHttp = new XMLHttpRequest() || new ActiveXObject('Microsoft.XMLHTTP'); | |
xmlHttp.onreadystatechange = function(){ | |
if(xmlHttp.readyState==4 && xmlHttp.status==200){ | |
return callback(xmlHttp.responseText); | |
} | |
}; | |
xmlHttp.open('get', url, true); | |
xmlHttp.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment