We were looking for a way to display the age of an entry in SharePoint list for which creation date was specified. Since now using [today] in formula in SharePoint is not allowed, and we did not want to create redundant fields, we decided to weave a DOM level JavaScript to change the date value to Age, based on the today's date. Here's the code to use to replace date with age:<script> $("#tableID nobr").each(function(){ var c = new Date($(this).text()); var b = nehttp://www.blogger.com/img/blank.gif7; Date(); var diff = (b.getTime() - c.getTime())/(24*3600*1000); $(this).html(Math.ceil(diff) + " days");}) </script>
Here's another use of DOM level javascript, used to unlock levels in angry birds chrome.
No comments:
Post a Comment