[jQuery] Re: kill the cpu

2008-02-15 Thread Karl Rudd
What do you need to access outside the $(function(){})? For the function you can do something like this: var showtime; $(function(){ //... showtime = function() { //... }; }) // You can now do this showtime(); Is that what you're looking for? Karl Rudd On Thu, Feb 14, 2008 at 10:20

[jQuery] Re: kill the cpu

2008-02-13 Thread Sebastián V. Würtz
thx karl, im still learning jquery is a great thing, sometimes is miss the logic about it. and its work perfect, now the cpu is 5 to 11%, and i notice i must define the function showtime inside the $(function(){} because i lose the vars in other way, but how i can make it work from outside?

[jQuery] Re: kill the cpu

2008-02-13 Thread Karl Rudd
Part of the problem may be that the elements are being searched every time the function is called. $('.year').text(anio); $('.day').text(dia); $('.month').text(mes); $('.week').text(week); $('span.h').text(String(hours)); $('span.minute').text(String(minutes)); $('span.seconds

[jQuery] Re: kill the cpu

2008-02-13 Thread Josh Nathanson
Rather than call the function recursively, you might want to use setInterval rather than setTimeout, which is what I think you are trying to achieve...that is, run the function once per second. I think if you run the function recursively without an "exit strategy" you get a circular behavior

[jQuery] Re: kill the cpu

2008-02-13 Thread Shawn
Where's the "show_clock()" function? Or was that a typo? Otherwise, I don't see anything glaringly wrong with the code (just a quick glance though...) Shawn Sebastián V. Würtz wrote: can this code kill a cpu? $(function() { show_clock(); }); function showtime() { var meses = new