How many days til Christmas?
One of my friends really enjoyed the “Christmas Countdown” widget I have in the sidebar. I told her I would share the html code with her so she could use it in her blog. And it occurred to me that she might not be the only one interested in it, so here it is:
Copy and paste the following code into a text widget:
var day_description = “Christmas”;
var day_before = “Christmas Eve”;
var today = new Date();
var year = today.getYear();
if ((navigator.appName == “Microsoft Internet Explorer”) && (year < 2000))
year=”19″ + year;
if (navigator.appName == “Netscape”)
year=1900 + year;
var date = new Date(“December 25, ” + year);
var diff = date.getTime() – today.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
if (days > 1)
document.write(“There are ” + (days+1) + ” days until ” + day_description + “!”);
else if (days == 1)
document.write(“Tommorrow is ” + day_before + “!”);
else if (days == 0)
document.write(“Today is ” + day_before + “!”);
else if (days == -1)
document.write(“It’s ” + day_description + “!”);
else if (days < -1)
document.write(day_description + ” was ” + ((days+1)*-1) + (days < -2 ? ” days” : ” day”) + ” ago this year!”);
// End –>
There, that’s all there is to it. I am assuming you know how to do this, and if not, I’ll be happy to try to help if you leave me a comment.
I added an image, and some text to mine. Here’s what it looks like in html. The link to the image I used is shortened and highlighted in red. You will need to replace it with your own image link. My text is highlighted in green, and you’ll want to replace it as well:
<p><img width=”155″ height=”155″ alt=”” class=”art-lightbox” src=”http://shirleytwofeathers.com/solstice-e1476823767540.jpg“><br></p>
<p>I think it’s time go go shopping… maybe even buy some really cool stuff at my online shops!!</p>
Have fun with it!
Note: I did not write this code, I found it a long time ago and now I have no idea where it came from, or I would just give a link to the site where you could find it.
Leave a Reply
- Seriously? Really? So now that I have most of my other issues taken care o...
- Lots of New Stuff I have been super busy adding more cool stuff. I ha...
- A Small Adjustment I have added a drop down menu to the nav bar at the...
- Two Steps Forward…. When you take two steps forward and only 1 step bac...
- Plumbing Issues Well, my super cool and fun Ask The Plumber page quit w...
- Making Magic Happen I have been working really hard behind the scenes getti...
- Going Deep We've got a new project going on over at The Prospe...
- My Personal Blog Up and Running I've got something new, and it's ready to be seen!...
- Not Enough So, either there are not enough hours in my day, no...
- Something New! The Spirituality page has been upgraded and we now...