function showPictures() {
// Create a variable to allow me to dynamically insert div blocks
var tempText = document.createElement("div");
// Create a variable to construct html output in
var theText;
// Only Perform next test if XMLHttpRequest readyState value is set to Complete
if (xhr.readyState == 4) {
// Check XMLHttpRequest status to make sure it is set to OK before continuing
if (xhr.status == 200) {
// Create an array called allImages made of xml content tag blocks
var allImages = xhr.responseXML.getElementsByTagName("content");
// Step through each xml content block looking for ...
for (var i=0; i<allImages.length; i++) {
// Convert the data in each xml content block into a single string
tempText.innerHTML = getPixVal(allImages[i]);
// Modify the data in the 2nd p block of the content block
theText = tempText.getElementsByTagName("p")[1].innerHTML;
theText = theText.replace(/240/g,"75");
theText = theText.replace(/180/g,"75");
theText = theText.replace(/_m/g,"_s");
document.getElementById("pictureBar").innerHTML += theText;
}
}
else {
alert("There was a problem with the request " + xhr.status);
}
}
function getPixVal(inVal) {
return (inVal.textContent) ? inVal.textContent : inVal.text;
}
}
Item by Item Comment
Next Page