Thursday, 29 August 2013

javascript - document.GetElementByid in very easy script doesn't work

javascript - document.GetElementByid in very easy script doesn't work

I have this simple javascript/html script, but i dont'know why the
"GetElementByID" function dosen'work, anybody can help me?
The function:
function Disabilita(control)
{
if (control.checked)
{
alert ("checkbox ceccata");
document.getElementById(rag_soc_spedizione).disabled=TRUE;
document.getElementById(nome_spedizione).disabled=TRUE;
document.getElementById(cognome_spedizione).disabled=TRUE;
document.getElementById(nazione_spedizione).disabled=TRUE;
document.getElementById(provincia_spedizione).disabled=TRUE;
document.getElementById(comune_spedizione).disabled=TRUE;
}
else
alert ("checkbox non ceccata");
{
document.getElementById(rag_soc_spedizione).disabled=FALSE;
document.getElementById(nome_spedizione).disabled=FALSE;
document.getElementById(cognome_spedizione).disabled=FALSE;
document.getElementById(nazione_spedizione).disabled=FALSE;
document.getElementById(provincia_spedizione).disabled=FALSE;
document.getElementById(comune_spedizione).disabled=FALSE;
}
}
</script>
The element who the function has assigned
<input type="checkbox" value="true" name="dati-sped-fatt"
id="dati-sped-fatt" onClick="Disabilita(this)">
both allert appears but no one of controls get disabled. thanks for the
help and sorry for my poor english

No comments:

Post a Comment