Palko17
12-12-2007, 03:27 AM
I merged my earlier posted script with another script, the AJAX works now, but it won't change the images to the correct src... I have no idea what JS's problem is, but it's got serious ones...
var offsetx=0;
var offsety=0;
function getKey(e, thisoffsetx, thisoffsety, firstx, firsty) {
var firstx=offsetx+firstx;
var firsty=offsety+firsty;
if (e.keyCode=='38') {
for (var y=1; y<=17; y++) {
thisfirstx=firstx;
for (var x=1; x<=20; x++) {
thisfirstx++;
if (window.XMLHttpRequest) {
myRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) {
myRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
myRequest.onreadystatechange = function() {
if (myRequest.readyState == 4) {
var thisimageid="mapTile"+x+"_"+y;
var imageLink="*********"+myRequest.responseText;
document.thisimageid.src=imageLink;
}
}
myRequest.open('GET', '************?x=' + thisfirstx + '&y=' + firsty + '&direction=up', true);
myRequest.send(null);
}
firsty++;
}
offsety= thisoffsety-1;
}
}
var offsetx=0;
var offsety=0;
function getKey(e, thisoffsetx, thisoffsety, firstx, firsty) {
var firstx=offsetx+firstx;
var firsty=offsety+firsty;
if (e.keyCode=='38') {
for (var y=1; y<=17; y++) {
thisfirstx=firstx;
for (var x=1; x<=20; x++) {
thisfirstx++;
if (window.XMLHttpRequest) {
myRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) {
myRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
myRequest.onreadystatechange = function() {
if (myRequest.readyState == 4) {
var thisimageid="mapTile"+x+"_"+y;
var imageLink="*********"+myRequest.responseText;
document.thisimageid.src=imageLink;
}
}
myRequest.open('GET', '************?x=' + thisfirstx + '&y=' + firsty + '&direction=up', true);
myRequest.send(null);
}
firsty++;
}
offsety= thisoffsety-1;
}
}