Hi,

>         $$('img.alpha').setOpacity(0.5);

$$ returns an array[1][2], and arrays don't have a setOpacity method.
You want to call the setOpacity method on each element in the array,
which you can do in a variety of ways thanks to Prototype's Enumerable
[3] mix-in, which it mixes in with arrays.  In this case, probably
Enumerable#invoke[4].

[1] http://prototypejs.org/api/array
[2] 
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array
[3] http://prototypejs.org/api/enumerable
[4] http://prototypejs.org/api/enumerable/invoke

HTH!
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jun 12, 12:28 am, Brown Freelance <sc...@brownfreelance.com> wrote:
> Not sure what I'm doing wrong here but here is my problem:
>
> I have a few images that I want to display with 50% opacity. I've
> given these images the class name of alpha.
>
> Example:
> <img src="../images/snapshots/thumbs/gma_x158.gif" alt="Greg Martin
> Auctions" width="156" height="118" class="alpha" />
>
> Then, after the body tag I have:
> <script language="javascript" type="text/javascript">
>         $$('img.alpha').setOpacity(0.5);
> </script>
>
> This does not work for me. It dose work however work if I give the img
> element an ID but that of course is not valid CSS if I use more then
> one and I would rather not give each img their own ID.
>
> Any help would be greatly appreciated.
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to