First page Back Continue Last page Image
- // When the page loads run the initPage Function
- window.addEventListener("load",initPage,false);
- function initPage() {
- // Create a new variale called now and load it with the current Date and Time
- var now = new Date();
- // Create a new variable called lastVisit and load it with the date from the cookie
- var lastVisit = new Date(cookieVal("pageVisit"));
- // Create a new variable called expireDate and load it with todays date
- var expireDate = new Date();
- // Revise the expireDate by adding 6 to the Month substring
- expireDate.setMonth(expireDate.getMonth()+6);
- // Create a new cookie with a page visit date of now and a 6 month life
- document.cookie = "pageVisit=" + now + ";expires=" + expireDate.toGMTString();
- // Create a new array of all the paragraph objects in the current web page
- var allGrafs = document.getElementsByTagName("p");
- // Step through each element in the array
- for (var i=0; i<allGrafs.length; i++) {
- // If you find one with an id that contains “New-” and if found
- if (allGrafs[i].id.indexOf("New-") != -1) {
- // Run the function newCheck passing the id name and the end of the substring starting at the 5th character
- newCheck(allGrafs[i],allGrafs[i].id.substring(4));
- }
- }
-