Guest User

Untitled

a guest
Jun 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. var sDate = new Date()
  2. , today = new Date()
  3. , str = ""
  4. , node;
  5.  
  6. sDate.setFullYear(2011, 0, 1);
  7.  
  8. if (sDate > today) {
  9. str = sDate.getFullYear() }
  10. else {
  11. str = '2010-' + sDate.getFullYear() }
  12.  
  13. // adds the date to the document
  14. node = document.createTextNode(str); // creates a text element that holds the data to write to the document
  15. document.body.appendChild(node); // appends the node to the document (making it visible)
Add Comment
Please, Sign In to add comment