Httml Code:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>untitled document</title>
<body onload= "Start ()" >
</body>
JS Code:
Copy Code code as follows:
<script language= "JavaScript" type= "Text/javascript" >
<!--
function GetCookie (name) {
if (Document.cookie.length > 0) {
Start = document.cookie.indexOf (name + "=");
If (Start!=-1) {
Start = start +name.length + 1;
End = Document.cookie.indexOf (";", start);
if (end = = 1) {
end = Document.cookie.length;
}
Return decodeURI (document.cookie.substring (start,end));
}
}
Return "";
}
function Setcookie (name, value, expires, path, domain, secure) {
var Curcookie = name + "=" +encodeuri (value)
+ ((expires)? "; expires=" + expires.togmtstring (): "")
+ (path)? ";p ath=" + Path: "")
+ (domain)? ";d omain=" + domain: "")
+ (Secure)? "; Secure": "");
Document.cookie = Curcookie;
}
function Start () {
var text = "";
var visitorname = GetCookie ("Visitorname");
var lasttime = GetCookie ("Time");
var isnmonth = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var isnday = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var today = new Date ();
var year = Today.getyear ();
var day = Today.getdate ();
var cookietime = year + "Years" + isnmonth[today.getmonth ()] + day + "days" + Isnday[today.getday ());
Today.settime (Today.gettime () + 365*24*60*60*1000);
Setcookie ("Time", cookietime,today);
if (Visitorname = = "") {
Visitorname = Prompt ("Input Your Name:");
Setcookie ("Visitorname", visitorname,today);
document.write ("Hello," + Visitorname + "for the first time on the site, please mention the precious meaning");
}
else {
Text + "Hello," + Visitorname + "You are the first" + count () + "interview this site,<br> last interview for:" + lasttime;
document.write (text);
}
}
function count () {
var now = new Date ();
Now.settime (Now.gettime () + 365*24*60*60*1000);
var visits = GetCookie ("counter");
if (!visits) {
visits = 1;
}else {
visits = parseint (visits) + 1;
}
Setcookie ("Counter", Visits,now);
return visits;
}
-->
</script>