Results 1 to 7 of 7
Hybrid View
-
13th Aug 2011, 03:45 AM #1Member
Try this:
Code:<script type="text/javascript"> var now=new Date() //Enter the Anniversary's MONTH (1-12) and DAY (1-31): var then=new Date(now.getFullYear(), 8, 18) var th = now.getFullYear() - 2000 // 11th anniversary on 2011 var monthtext=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sep","Oct","Nov","Dec") then.setMonth(then.getMonth()-1) //change to 0-11 month format var showdate="("+monthtext[then.getMonth()]+" "+then.getDate()+")" //show date of Anniversary var one_day=1000*60*60*24 var calculatediff="" calculatediff=Math.ceil((then.getTime()-now.getTime())/(one_day)) if (calculatediff<0){ var nextyearnow=new Date() nextyearnow.setFullYear(now.getFullYear()+1) calculatediff=Math.ceil((nextyearnow.getTime()-now.getTime())/(one_day)+calculatediff) th += 1 } var beforeAnniversaryText="day's Until " + th + "th Anniversary" var onAnniversarytext="Today is Anniversary. Hooray :D" //Display message accordingly var pluraldayornot=(calculatediff==1)? "day" : "days" if (calculatediff>0) document.write("<b>"+calculatediff+" "+pluraldayornot+" "+beforeAnniversaryText+" "+showdate+"!</b>") else if (calculatediff==0) document.write("<b>"+onAnniversarytext+" "+showdate+"!</b>") </script>
johnburn Reviewed by johnburn on . Help with Java Script I have the following java script for dispalying how long our gaming clan has been around. What it does is count downs the days until a sertain date, which is our Anniversary. What I would like to do is modify this code to update the year ("August 18, 2010") and restart the count and update the number of years or the Anniversary with out having to do it manually . <SCRIPT LANGUAGE = "JavaScript"> var now = new Date(); // set this value to the countdown date. var then = new Date("August 18, Rating: 5
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Java stinks: Turn off your Java browser plugin
By Loget in forum General DiscussionReplies: 37Last Post: 5th Sep 2012, 07:40 AM -
Need help in JAVA
By digimon in forum Web Development AreaReplies: 10Last Post: 20th Jan 2012, 04:53 AM -
Need a java script programmer, imacros programmer
By Vatra_Wolf in forum Traffic Market (Buy, Sell and Trade)Replies: 0Last Post: 21st Sep 2011, 03:01 PM -
Need Help HTML/Java Script Twitter/Countdown fixing
By Andy~s in forum Web Development AreaReplies: 0Last Post: 19th Dec 2010, 06:29 PM -
[Urgent] Help needed with "onClick=" Java script.
By kushubham9 in forum Web Application/Script SupportReplies: 0Last Post: 7th Mar 2010, 01:56 AM
themaLeecher - leech and manage...
Version 5.05 released. Open older version (or...