JavaScript Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Free Java Script Codes
Javascript List All
Slide Show Slide Show
Ad Display Ad Display
Image Effect Image Effect
Animated Image Effects Animated Image Effects
Form Validation Form Validation
Color Picker Tool Color Picker Tool
Formatting Forms Formatting Forms
Select All Select All
Dynamic Form Select Dynamic Form select
Dynamic Color Dynamic Color
Calendar Script Calendar
Textbox Counter Textbox Counter
Alphanumeric Alphanumeric
Date Time Script Date & Time
Stop Watch Script Stop Watch script
Delete Repeated Values Delete Repeated Values
Pagination Pagination
Random Generator Random Generator
Animated Text Animated Text
Cursor Position Cursor Position
User Info Window / User Info
Security Security / Authenticate
Bookmark Bookmark
Mouse Effects Mouse Effects
Title Bar Title Bar
Status Bar Status Bar
Country List Country List
Free Games Free Games
Calculators Calculators
 




Last Visit Script


About
  When the user first visits your website, it will display an undefined message. Then the script will write a cookie on the users machine that contains date and time. When the user returns to your site, this javascript will read the cookie, return a message to the browser and overwrite the cookie with a new one that display date and time.


Features
a) Used to know the last visited time for the specific website.
b) Easy and simple to use.

Preview




Code
Javascript Code
<!-- Script by hscripts.com -->
<!-- Copyright of HIOXINDIA -->
<!-- More scripts @www.hscripts.com -->

<script type="text/javascript">
function getCookie(c_name)
{
  if(document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1)
    {
      c_start=c_start + c_name.length+1;
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
       return unescape(document.cookie.substring(c_start,c_end));
    }
  }
  return "";
}
function setCookie(c_name,value,expiredays)
{
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+expiredays);
  document.cookie=c_name+ "=" +escape(value)+
  ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  var x = document.cookie(username);
  alert("sfs"); 
  document.write(x);
}
function showmessage ()
{
  var days=421;
  nextvisitmsg="Hi Welcome back ! Your last visit was on [displaydate]";
  var dat=new Date();
  if(getCookie("visit")==""){
     setCookie("visit", dat, days);
    document.write("you are visting this website for the first time ");
  }
  else
  {
    var p=getCookie("visit");
    var pp=Date.parse(p);
    var now = new Date();
    now.setTime(pp);
    var day = new Array("Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat");
    var month = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
    var nd = now.getDate();
    var ny = now.getDay();
    ny = day[ny];
    var nm = now.getMonth();
    nm = month[nm];
    yy = now.getFullYear();
    var hh = now.getHours();
    var ampm = "AM";
    if(hh >= 12) {ampm = "PM"}
      var mins = now.getMinutes();
      var secs = now.getSeconds();
      var dispDate = ny + ", " + nm + " " + nd + ", " + yy + " " + hh + ":" + mins + ":" + secs + " " + ampm;
      document.write(nextvisitmsg.replace("\[displaydate\]", dispDate))
  }
  setCookie("visit", dat, days);
}
 function ctck()
{
    var sds = document.getElementById("dum");
    if(sds == null){
        alert("You are using a free package.\n You are not allowed to remove the tag.\n");
    }
    var sdss = document.getElementById("dumdiv");
    if(sdss == null){
        alert("You are using a free package.\n You are not allowed to remove the tag.\n");
    }
}
document.onload="ctck()";
showmessage ();
</script>
<div style="font-size: 10px;color: #dadada;" id="dumdiv"> <a href="http://www.hscripts.com" id="dum" style="text-decoration:none;color: #dadada;">©h</a></div>
<!-- Script by hscripts.com -->

Release Date - 08-02-2010
Get free version without ©copyright link for just 5 price

For customization of this script or any script development, contact us at support@hscripts.com


Usage
 a) Copy and paste the javascript code into your HTML page and make use of this script.
 b) This script is used to display the last visited date and time of the specific website.



License
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.
Other Links

web hosting