hi,
I'm trying to lock out specific fields on a form using the following..
now the above works, but shouldn't the logic be
I can't grasp why it works by saying if it finds the element type in the string to disable, when it should be if it doesn't find a match then disable.
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
I'm trying to lock out specific fields on a form using the following..
Code:
var elem = document.getElementById(formID).elements;
var excl = 'button,image,label,legend';
for(var i=0;i< elem.length;i++){
[b]if(excl.search(elem[i].type)){
elem[i].disabled = true;
}[/b]
}
now the above works, but shouldn't the logic be
Code:
if(!excl.search(elem[i].type))
I can't grasp why it works by saying if it finds the element type in the string to disable, when it should be if it doesn't find a match then disable.
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!