Take a look at this page I threw up on jsbin: http://jsbin.com/uzecu/edit
It uses a neat little random color generator I found years ago bound to an event. Seems pretty quick, too. The javascript: $(function(){ $('.colour') .bind('randomizeColor', function(){ this.style.background = (Math.round(0xFFFFFF * Math.random()).toString(16) + "000000").replace (/([a-f0-9]{6}).+/, "#$1").toUpperCase()}) .trigger('randomizeColor'); }); On Mar 20, 1:24 pm, Thierry L <lamthie...@gmail.com> wrote: > Great, that helps but I think I'll do it from the server side code, > the web page loads much faster when the operation is done on the > server side. > > On Mar 20, 12:58 pm, Charlie Griefer <charlie.grie...@gmail.com> > wrote: > > > On Fri, Mar 20, 2009 at 9:48 AM, Thierry <lamthie...@gmail.com> wrote: > > > > I have a bunch of hyperlinks with class 'hello_world'. I want to > > > assign each one of them a random colour. I can set the colour for all > > > of them with the following: > > > > $("a[class=hello_world]").css("color", "red"); > > > > How can I iterate over every element with class name 'hello_world'? > > > $(function() { > > $('a[class=hello_world]').each(function() { > > randomColor = (some code here to create a random color); > > $(this).css('color', randomColor); > > > }); > > }); > > > -- > > I have failed as much as I have succeeded. But I love my life. I love my > > wife. And I wish you my kind of success.