Results 1 to 7 of 7
-
26th Oct 2010, 09:25 PM #1OPMember
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, 2010");
var gap = then.getTime() - now.getTime();
gap = Math.floor(gap / (1000 * 60 * 60 * 24));
document.write(gap);
</SCRIPT>
<!--your message here-->day's Until 10th AnniversaryQRob001 Reviewed by QRob001 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
-
8th Nov 2010, 02:00 AM #2OPMember
No one has any idea how to help me with this?
-
9th Nov 2010, 07:04 AM #3Member
check these links .. it might help
Code:http://www.hashemian.com/tools/javascript-countdown.html http://www.askdavetaylor.com/how_do_i_create_a_javascript_countdown_timer_on_my_web_page.html
-
10th Nov 2010, 10:50 PM #4Respected Member
What do you mean manually? You want the date to change automatically to what?
-
12th Aug 2011, 04:58 AM #5OPMember
I checked those 2 links im9ure but they were just creating a countdown timer like the one I have.
Yes Lock Down, I want it to update to the next year and begin the countdown. Just as if I had updated the year my self.
<SCRIPT LANGUAGE = "JavaScript">
var now = new Date();
// set this value to the countdown date.
var then = new Date("August 18, 2010");
var gap = then.getTime() - now.getTime();
gap = Math.floor(gap / (1000 * 60 * 60 * 24));
document.write(gap);
</SCRIPT>
<!--your message here-->day's Until 10th Anniversary
I would like the year date "2010" to updat to "2011" when the count down reaches "0". Then I would like it to update the year anniversary "10th" to "11th".
-
13th Aug 2011, 03:45 AM #6Member
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>
-
18th Aug 2011, 03:23 AM #7OPMember
Cool, thanks. I'll give it a try.
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
themaManager - edit and manage...
Version 4.04 released. Open older version (or...