How many days til Christmas?

112443

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:

<script language=”JavaScript”>

<!– Begin
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));

document.write(“<center><h3>”)

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!”);
document.write(“</h3></center>”);
// End –>
</script>

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

Your email address will not be published. Required fields are marked *

Image Credit:

If an image has posted without permission please leave a comment and I will happily remove it, replace it, give credit, link love ~ whatever you prefer.

Subscribe

Enter your email address:

Delivered by FeedBurner

Archives
I Wonder
“What great thing would you attempt if you knew you could not fail?” — Robert Schuller
Christmas?


I think it's time to go shopping... maybe even buy some really cool stuff at my online shops!!

Stat Counter