I'm not sure I understand. Could you post the actual code including the way that you are setting getFruitAbbr?

On Mar 26, 2010, at 2:58 PM, chrysanthe m wrote:

Hi Jeff
That is what I thought, however is it a subtle (or I am not subtly stupid, grin) issue with the single quote. If I reveal the value with an alert it shows only as apple. I tried another example where I called a function with one parameter from a onClick() that passed the key as 'key' and that worked. I just cant get it to work within code, which I know is odd.

On Fri, Mar 26, 2010 at 2:50 PM, Jeffrey Peck <jeff.p...@snet.net> wrote: 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 prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . 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 prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . 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 prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . 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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to