
Originally Posted by
tedc83
Code:
function disableNoBiz(){
var x = rbjsA;
for (var i = 0;i<x.length;i++){
document.quoteService.rb[i].disabled = true;
}
}
When square brackets are used like they are above, they are interpreted as property accessors. On each iteration, the scripting engine will be trying to find numbered properties, 0 through (x.length - 1), of a variable, rb. Instead, we need to use square brackets in a different way:
Code:
document.forms.quoteService.elements['rb[' + i + ']'].disabled = true;
Notice the expression - a string concatenation - in the outer set of square brackets? The result of this concatenation (for example, rb[0] on the first loop iteration) is used to look up a form element.
Hope that helps,
Mike
P.S. Use the [code]...[/code] sequences to show code snippets, and use spaces (preferably two) not tabs to indent. Deep nesting becomes unmanagable at eight spaces per tab.
Bookmarks