Word Herder (word_herder) wrote in component_help,
Word Herder
word_herder
component_help

Countdown Box

I'm trying to create a "Countdown Component" (going to Rome in 52 days).

<script type="text/javascript">



<!-- Countdown script distributed by http://www.hypergurl.com



var today=new Date()



//Enter the date for your countdown. Month first then day. Example 6th month 26th day.

var countdown=new Date(today.getFullYear(), 3, 19)



//Enter your message here! Change words below to suit

var beforedayText="left until pilgrimage to Rome!"

var ondaytext="We have left for Rome!"



var monthtext=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sep","Oct","Nov","Dec")

countdown.setMonth(countdown.getMonth()-1) //change to 0-11 month format

var showdate="("+monthtext[countdown.getMonth()]+" "+countdown.getDate()+")"



var one_day=1000*60*60*24

var calculatediff=""



calculatediff=Math.ceil((countdown.getTime()-today.getTime())/(one_day))

if (calculatediff<0){

var nextyeartoday=new Date()

nextyeartoday.setFullYear(today.getFullYear()+1)

calculatediff=Math.ceil((nextyeartoday.getTime()-today.getTime())/(one_day)+calculatediff)

}



var pluraldayornot=(calculatediff==1)? "day" : "days"

if (calculatediff>0)

document.write("<b>"+calculatediff+" "+pluraldayornot+" "+beforedayText+" "+showdate+"!</b>")

else if (calculatediff==0)

document.write("<b>"+ondaytext+" "+showdate+"!</b>")

-->

</script>



I think this is java, and I've heard that it doesn't work well with livejournal. Is there an alternate way to do this?
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 5 comments