First page Back Continue Last page Image
- window.addEventListener("load",initPage,false);
- function initPage() {
- var now = new Date();
- var lastVisit = new Date(cookieVal("pageVisit"));
- var expireDate = new Date();
- expireDate.setMonth(expireDate.getMonth()+6);
- document.cookie = "pageVisit=" + now + ";expires=" + expireDate.toGMTString();
- var allGrafs = document.getElementsByTagName("p");
- for (var i=0; i<allGrafs.length; i++) {
- if (allGrafs[i].id.indexOf("New-") != -1) {
- newCheck(allGrafs[i],allGrafs[i].id.substring(4));
- }
- }
- function newCheck(grafElement,dtString) {
- var yyyy = parseInt(dtString.substring(0,4),10);
- var mm = parseInt(dtString.substring(4,6),10);
- var dd = parseInt(dtString.substring(6,8),10);
- var lastChgd = new Date(yyyy,mm-1,dd);
- if (lastChgd.getTime() > lastVisit.getTime()) {
- grafElement.className += " newImg";
- }
- }
- }
- function cookieVal(cookieName) {
- var thisCookie = document.cookie.split("; ");
- for (var i=0; i<thisCookie.length; i++) {
- if (cookieName == thisCookie[i].split("=")[0]) {
- return thisCookie[i].split("=")[1];
- }
- }
- return "1 January 1970";
- }
- New Since You were here Last
- <!DOCTYPE html>
- <html>
- <head>
- <title>New for You</title>
- <link rel="stylesheet" href="script07.css">
- <script src="script07.js"></script>
- </head>
- <body>
- <p>Negrino and Smith's most recent books:</p>
- <p id="New-20140601"><a href="http://www.javascriptworld.com">JavaScript: Visual QuickStart Guide, 9<sup>th</sup> Edition</a></p>
- <p id="New-20130812"><a href="http://www.dreamweaverbook.com">Dreamweaver CC: Visual QuickStart Guide</a></p>
- </body>
- </html>
- body {
- background-color: #FFF;
- }
- p.newImg {
- padding-left: 35px;
- background-image: url(images/new.gif);
- background-repeat: no-repeat;
- }
20181102
yyyy = 2018 Decimal
mm = 11 Decimal
dd = 02 Decimal
LastChgd=2018,10,02