Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sDate = new Date()
- , today = new Date()
- , str = ""
- , node;
- sDate.setFullYear(2011, 0, 1);
- if (sDate > today) {
- str = sDate.getFullYear() }
- else {
- str = '2010-' + sDate.getFullYear() }
- // adds the date to the document
- node = document.createTextNode(str); // creates a text element that holds the data to write to the document
- document.body.appendChild(node); // appends the node to the document (making it visible)
Add Comment
Please, Sign In to add comment