No problem, happens with all of us :) Thanks & Regards, Dhruva Sagar.
On Tue, Dec 15, 2009 at 9:39 PM, Glen_H <glen.f.he...@gmail.com> wrote: > yeah, you are right, it appears as though i may have over thought it. > thanks for the response! > > It worked perfectly btw. > > thanks again. > > Glen > > On Dec 15, 11:05 am, Dhruva Sagar <dhruva.sa...@gmail.com> wrote: > > There could be many ways to do that. If only you put in a little thought > to > > it :). > > > > This is one of the ways, I am sure this is not the best way, but it > surely > > should meet your demands. > > > > $("#btnTraffic").click(function(){ > > var tr_id = "#trafficLight"; > > if ( $(tr_id).css('background-color') == 'red' ) > > $(tr_id).css("background-color","yellow"); > > else if ( $(tr_id).css('background-color') == 'yellow' ) > > $(tr_id).css('background-color', 'green'); > > else > > $(tr_id).css('background-color', 'red'); > > > > }); > > > > Thanks & Regards, > > Dhruva Sagar. > > > > On Tue, Dec 15, 2009 at 9:25 PM, Glen_H <glen.f.he...@gmail.com> wrote: > > > here is my problem: > > > > > $("#btnTraffic").click(function(){ > > > $("#trafficLight").css("background-color","yellow"); > > > > > }); > > > > > btnTraffic is my button, when I click it, it changes from red to > > > yellow because of the css. > > > > > I want to click it multiple times and have it rotate between red, > > > yellow and green. > > > > > so it starts red, I click it, it turns yellow, then I click it and it > > > turns green, then click again back to red, so on and so forth. anyone > > > have any idea how to make that happen? I can change it once no > > > problem, but I need some type of loop command or something like that. > > > > > Thanks in advance ! > > > > > Glen >