>         $$('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

[1] http://prototypejs.org/api/array
[3] http://prototypejs.org/api/enumerable
[4] http://prototypejs.org/api/enumerable/invoke

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 
For more options, visit this group at 

Reply via email to