Hey,
Setting styles can be done using the the setStyle method:
http://api.prototypejs.org/dom/element/setstyle/
Selecting elements using a css selector can be done using the $$ method
which is short for Element.select() but then global:
http://api.prototypejs.org/language/dollardollar/
http://api.prototypejs.org/dom/element/select/
Since $$ and Element.select both give an array of elements (even it's just
1) you can invoke the setStyle method on each element:
http://api.prototypejs.org/language/enumerable/prototype/invoke/
so in your case this should work:
$$("td:contains('Pendiente')").invoke('setStyle', {
background: '#c00'
});
Take a look at the links I mentioned above for possible optimalisations on
that code.
Greetings,
Johan
On Tue, Aug 31, 2010 at 3:39 PM, VEO creativos wrote:
> Hi! I'm trying to assign a CSS style to a TR that contains the words
> "Pendiente", "Procesando" and "Completo".
> I've made this for jQuery, but I need to do it with prototype/
> scriptaculous and I'm a totally newbie.
>
> Thanks in advance for any help!
>
> This is the code I've made for jQuery:
>
> $("td:contains('Pendiente')").css("background", "#c00");
> $("td:contains('Procesando')").css("background", "#0c0");
> $("td:contains('Completo')").css("background", "#000");
>
>
> 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-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.
>
>
--
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.