//function to validate fields
function validateField(oEvent) {
oEvent = oEvent || window.event;
var txtField = oEvent.target || oEvent.srcElement;

var btnNext = document.getElementById("btnNext");
btnNext.disabled = true;

if (iTimeoutId != null) {
clearTimeout(iTimeoutId);
iTimeoutId = null;
}

if (!oXmlHttp) {
oXmlHttp = zXmlHttp.createRequest();
} else if (oXmlHttp.readyState != 0) {
oXmlHttp.abort();
}

oXmlHttp.open("get", "ValidateForm.php?" + txtField.name + "=" + encodeURIComponent(txtField.value), true);
oXmlHttp.onreadystatechange = function () {

if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
var arrInfo = oXmlHttp.responseText.split("||");

if (!eval(arrInfo[0])) {
txtField.valid = false;
} else {
txtField.valid = true;
}

btnNext.disabled = !txtField.valid;
} else {
alert("An error occurred while trying to contact the server.");
}
}
};

iTimeoutId = setTimeout(function () {
oXmlHttp.send(null);
}, 500);
};


//if Ajax is enabled, disable the submit button and assign event handlers
window.onload = function () {
if (zXmlHttp.isSupported()) {
var btnNext = document.getElementById("btnNext");
var txtUsername = document.getElementById("txtUsername");

btnNext.disabled = true;
txtUsername.onkeyup = validateField;
txtUsername.onchange = validateField;
txtUsername.valid = false;
}
};
If i have a second textfield and button, how can i validate it or controll it? If i include a second textfield and button, then the code controlled both. OK this is right: Both buttons are disabled. But if i write in one of both textfield a correct word then both buttons are available I want that only one button is available, the button where the correct word in the textfield is

Hope u know what i mean.
Short image

///////Nothing/////// Button (disabled)
//////BerlinerMC///// Button (available)
/////Test/////// Botton (disabled)

Hope u know what i mean!!!

Greetings
BerlinerMC

P.S. PLs dont be cross with me, because of my english