Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Design

Counter widget issue - I want it to stop counting!

Author Message
marcintosh



Joined: 09 Apr 2006
Posts: 20

Posted: Sat May 13, 2006 - 4:34 pm    Post subject: Counter widget issue - I want it to stop counting! Reply with quote

I made a movie countdown widget (Snakes on a Plane) and now I'm trying to tweak it so that when the movie comes out, it will stop counting. I don't want it to show -1, -2, -3, etc.

It's basically done. On the target date it will stop counting and show a different image. I set the code as an
Code:
if
statement, like this:

Code:
    if (sg1CountDown("18 Aug 2006") >= 1) {
        document.getElementById("number").innerHTML = sg1CountDown("18 Aug 2006")
    }

So it will only show the days until the event if the event hasn't occured yet. It works great, but the last value displayed (1) doesn't go away when it stops counting. If I close and re-open the widget that does the trick, but I don't want people to have to do that. For this type of widget that's more trouble than it's worth.

Any ideas how to get it to refresh automatically? I tried an
Code:
onhide
and
Code:
else
atributes, but they didn't work.

Thanks in advance.
View user's profile Send private message Send e-mail Widgets
purvisa



Joined: 21 Jul 2005
Posts: 182
Location: Kirkland, WA

Posted: Tue Jun 06, 2006 - 8:02 pm    Post subject: Reply with quote

Add an else statement that sets the counter to zero when the condition is false. You are currently only updating it when the number is non-zero, but you want it to update when the number is zero or lower, and that can be handled by turning your IF into an IF-ELSE.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group