ShadowIce
04-27-2009, 04:54 PM
Hi everybody.
Could someone help me make it so this script disables all buttons and textareas and stuff BESIDES whats in the function named "on()" ?
for example
if theres 2 buttons in on, a button named "one" and a button called "2", it will disable EVERYTHING BUT the buttons one & two
function on(){
disableForm(document.forms.calculator.one);
disableForm(document.forms.calculator.two);
}
function disableForm(thename) {
var numberForms = document.forms.length;
var formIndex;
for (formIndex=0; formIndex<numberForms; formIndex++)
{
for(x=0;x<document.forms[formIndex].length;x++)
if(document.forms[formIndex].elements[x] +== thename){
document.forms[formIndex].elements[x].disabled=false
}else{
document.forms[formIndex].elements[x].disabled=true
}
}
}
thank you!
~Shadow~
Could someone help me make it so this script disables all buttons and textareas and stuff BESIDES whats in the function named "on()" ?
for example
if theres 2 buttons in on, a button named "one" and a button called "2", it will disable EVERYTHING BUT the buttons one & two
function on(){
disableForm(document.forms.calculator.one);
disableForm(document.forms.calculator.two);
}
function disableForm(thename) {
var numberForms = document.forms.length;
var formIndex;
for (formIndex=0; formIndex<numberForms; formIndex++)
{
for(x=0;x<document.forms[formIndex].length;x++)
if(document.forms[formIndex].elements[x] +== thename){
document.forms[formIndex].elements[x].disabled=false
}else{
document.forms[formIndex].elements[x].disabled=true
}
}
}
thank you!
~Shadow~