JavaScript Zone

Script Tutorials

Introduction
Pre-requisites
Installation
Notes

Last Visit / Visit Count

Introduction
Related Links

This Javascript displays 1 of 2 messages to the user: a message inviting them to register, or the date last visited and visit count for registered visitors.

Click on the link below for a demonstration of this script. On the following page, move the mouse over or click on the 'Greetings' link.

Greetings Message Demo

Pre-requisites

  • the visitor registration script must already be installed on your web pages
  • the tooltips javascript from DynamicDrive.com
Installation

  1. Cut and paste the following code to your html page as indicated:

Notes

  • this tutorial demonstrates:
    • how to use cookies
  • the code for maintaining cookies is taken from the original date last visited / number of visits javascript from the JavaScript Source - thanks
  • if you use this script, amend the variable names' prefix from pt_ to something meaningful to your site
  • this tutorial has been amended from the JavaScript Source's original so that the last visit date and visit count are only updated when the date has changed. If you revisit the page several times in one day the date last visit and count become meaningless otherwise.


Page last updated 10th February 2001