Geoff, My guess is it's the for..in that's doing you in. Check out the docs on Array (http://www.prototypejs.org/api/array) and Enumerable (http://www.prototypejs.org/api/enumerable) for details. For..in does not iterate the elements of an array; it iterates the properties of an object. These seem like the same thing in some JavaScript implementations (but not all), but that stops happening when Prototype adds its syntactic sugar to Array.
Separately: You are relying quite heavily on semicolon insertion, which can tend to obscure odd bugs. It's best to always explicitly use semicolons, never to rely on JavaScript to guess correctly where they should go. There are good maintainability reasons for this, as well as the pragmatic reason that you pretty much can't use minimisers on your code if you don't put semicolons in. Hope this helps, -- T.J. Crowder tj / crowder software / com On Apr 19, 8:49 am, geoffcox <[EMAIL PROTECTED]> wrote: > Hello, > > Can anyone please see why as soon as add a link to prototype.js I get > an error message > > F["B" + Next[J]] has no properties > > I have tried changing the variable names but still get the error > message. > > Help! Cheers Geoff > > var Arry = [ > /* State 0 : */ [1,2], > /* State 1 : */ [3], > /* State 2 : */ [3], > /* State 3 : */ [4,5], > /* State 4 : */ [6], > /* State 5 : */ [6], > /* State 6 : */ [7,8], > /* State 7 : */ [9], > /* State 8 : */ [9], > /* State 9 : */ [10,11]] > > var result =new Array(); > var test_num=1; > function A(f) {soundManager.play('mySound'+test_num ,'../assets/audio- > group1/Track' + (+test_num + 22) + '.mp3'); } > function B(f) { result[test_num] = "same"; test_num++;} > function C(f) { result[test_num] = "different";test_num++; } > > DoSpecificTask = [A, B, C, A, B, C, A, B, C, A, B, C] > > function Fn(Arg) { > var F = Arg.form, State, J, Next > State = Arg.value > for (J=0 ; J<12 ; J++) F["B"+J].disabled = "disabled" // clear all > Next = Arry[State] > for (J in Next) F["B"+Next[J]].disabled = "" // set some > DoSpecificTask[State](F) > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---