Halloechen,
hier bin ich wieder! Habe eine Frage:
Ich wollte folgende Funktion ein wenig eleganter umschreiben und einen Counter verwenden, anstatt jedes einzelne Button anzusprechen:
Also statt (was funktioniert):
function checkThis2(){
if(document.business.facility[0].checked){
document.business.constyle[0].disabled= "";
document.business.constyle[1].disabled= "";
document.business.constyle[2].disabled= "";
document.business.constyle[3].disabled= "";
document.business.constyle[4].disabled= "";
document.business.constyle[5].disabled= "";
document.business.timebc.disabled= "";
}
if(document.business.facility[1].checked){
document.business.constyle[0].disabled="disabled";
document.business.constyle[1].disabled="disabled";
document.business.constyle[2].disabled="disabled";
document.business.constyle[3].disabled= "disabled";
document.business.constyle[4].disabled= "disabled";
document.business.constyle[5].disabled= "disabled";
document.business.timebc.disabled= "disabled";
document.business.constyle[0].checked = "";
document.business.constyle[1].checked = "";
document.business.constyle[2].checked = "";
document.business.constyle[3].checked = "";
document.business.constyle[4].checked = "";
document.business.constyle[5].checked = "";
document.business.timebc.value = "";
}
Folgendes:
function checkThis2(){
if(document.business.facility[0].checked){
for(var count=0; count<=5; count++){
document.business.constyle["+count+"].disabled= "";
}
document.business.timebc.disabled= "";
}
if(document.business.facility[1].checked){
for(var count = 0; count <= 5; count++){
document.business.constyle["+count+"].disabled="disabled";
document.business.constyle["+count+"].checked = "";
}
document.business.timebc.disabled= "disabled";
document.business.timebc.value = "";
}
}
Jedoch kriege ich immer die Fehlermeldung:
"document.business.constyle.+count+ is null or not an object"
Habe keine Ahnung, woran es liegen koennte. Kann jemand weiterhelfen?
Vielen Dank im Voraus,
Diana.