Forum Moderators: open
//get response - works
var result=xmlHttp.responseText;
//split the response into the two parts - works
var splitres=result.split("¦");
// execute another function with the first part - works fune
getPackageInfo(splitres[0]);
// use the second part to change value of button - doesnt work
var x=splitres[1];
document.forms["tmp_pak_react"].elements["tx"+x].value = "";
I keep getting a 'is either null or not object' error. When I change the value of x to say 78; all works fine, but when its 'splitres[1];' it doesnt.
Any ideas? =S
var x=splitres[1];
alert("x = " + x);
document.forms["tmp_pak_react"].elements["tx"+x].value = "";
Also, if your form elements have ids that match "tx"+x, then you could use getElementById instead:
var e = document.getElementById("tx"+x);
if(!e ) alert("Couldn't find element with id: tx" + x);
Perhaps convert it to an Int...
var x=parseInt(splitres[1]);
It should be typecast back to a string again when you: "tx"+x ...?