It's set(key,value). Your example should work as long as getFruitAbbr
is equal to 'apple' or 'banana' and would return 'a' or 'b'
respectively.
Also, make sure you are using Prototype 1.6 or above. Examples are
here:
http://www.prototypejs.org/api/hash
- Jeff
On Mar 26, 2010, at 2:39 PM, chrysanthe m wrote:
Hello
I have defined an array
var fruit = new Hash();
fruit.set('apple','a');
fruit.set('banana','b');
In code I get a string either from the user or passed between
functions, and store it in variable getFruitAbbr. However when I
try fruit.get(getFruitAbbr) for getFruitAbbr having one of the keys,
I get undefined. If I try to fruit.unset(getFruitAbbr) to eliminate
key and value pair, I get undefined. I believe my problem is I cant/
dont know the syntax to parameterize the access to a prototype
maintained hash table. Is that it? Something else? How do I
programatically, non-explicitly, access hash? tia.
--
You received this message because you are subscribed to the Google
Groups "Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
.
To unsubscribe from this group, send email to [email protected]
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
.
--
You received this message because you are subscribed to the Google Groups "Prototype
& script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.