Salve a tutti...
Non riesco a sistemare in modo che se i due campi sono compilati e disponibili abilita il pulsante SUBMIT, ecco il codice
function check_campi_1()
{
// code for IE7+, Firefox, Chrome, Opera, Safari
if(window.XMLHttpRequest)
{
var email = document.getElementById("email").value;
xmlhttp_1 = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp_1 = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp_1.onreadystatechange = function()
{
if(xmlhttp_1.readyState == 4 && xmlhttp_1.status == 200)
{
document.getElementById("cl_email").innerHTML = xmlhttp_1.responseText;
if(document.getElementById("cl_email").innerHTML == "OK")
{
check_1 = true;
}
}
}
xmlhttp_1.open("GET", "controls_php/amministratori/amministratori_n.php?email=" + email, true);
xmlhttp_1.send();
}
function check_campi_2()
{
var username = document.getElementById("username").value;
// code for IE7+, Firefox, Chrome, Opera, Safari
if(window.XMLHttpRequest)
{
xmlhttp_2 = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp_2 = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp_2.onreadystatechange = function()
{
if(xmlhttp_2.readyState == 4 && xmlhttp_2.status == 200)
{
document.getElementById("cl_username").innerHTML = xmlhttp_2.responseText;
if(document.getElementById("cl_username").innerHTM L == "OK")
{
check_2 = true;
}
}
}
xmlhttp_2.open("GET", "controls_php/amministratori/amministratori_n.php?username=" + username, true);
xmlhttp_2.send();
}
if(check_1 || check_2)
{
document.getElementById("registra").disabled = false;
}
window.onload = function()
{
document.getElementById("registra").disabled = true;
}
NOn funziona e perchè? Cosa ho sbagliato?

Rispondi quotando