sciguyryan
08-22-2003, 10:30 AM
hi all,
...a drop down menu of all the past dates that user has visited.
heres the script i have currently have:(writen here a while back)
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
<!--
var expDays = 100;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function Who(info){
var VisitorName = GetCookie('VisitorName')
if (VisitorName == null) {
VisitorName = prompt("What is your name?");
SetCookie ('VisitorName', VisitorName, exp);
}
return VisitorName;
}
function When(info){
var lastVisit = GetCookie('WWhenH')
if (lastVisit = null) {
lastVisit = new Date();
} else {
lastVisit = new Date(lastVisit);
}
var dayOfWeek = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][lastVisit.getDay()];
var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][lastVisit.getMonth()];
var day = lastVisit.getDate();
var year = lastVisit.getFullYear();
var hour = lastVisit.getHours();
var minute = lastVisit.getMinutes();
var second = lastVisit.getSeconds();
SetCookie ("WWhenH", (new Date()).getTime(), exp)
return (dayOfWeek+", "+month+" "+day+", "+year+" at "+hour+":"+minute+":"+second);
}
function Count(info){
var WWHCount = GetCookie('WWHCount')
if (WWHCount == null) {
WWHCount = 0;
}
else{
WWHCount++;
}
SetCookie ('WWHCount', WWHCount, exp);
return WWHCount;
}
function set(){
VisitorName = prompt("Who are you?");
SetCookie ('VisitorName', VisitorName, exp);
SetCookie ('WWHCount', 0, exp);
SetCookie ('WWhenH', 0, exp);
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
document.write
alert("Hello " + Who() + ".");
alert(" You've been here " + Count() + " time(s).");
alert(" Your last visit was " + When() +".");
//-->
</SCRIPT>
and, this is also displayed like this:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
document.write("Hello " + Who() + ". You've been here " + Count() + " time(s). Last time was " + When() +".");
</SCRIPT>
now, how could i modify this so that it displays all the past users visits? in the alerts and the text display
if you could modify this code for me i would be most great full.
thank you in advance.
...a drop down menu of all the past dates that user has visited.
heres the script i have currently have:(writen here a while back)
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
<!--
var expDays = 100;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function Who(info){
var VisitorName = GetCookie('VisitorName')
if (VisitorName == null) {
VisitorName = prompt("What is your name?");
SetCookie ('VisitorName', VisitorName, exp);
}
return VisitorName;
}
function When(info){
var lastVisit = GetCookie('WWhenH')
if (lastVisit = null) {
lastVisit = new Date();
} else {
lastVisit = new Date(lastVisit);
}
var dayOfWeek = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][lastVisit.getDay()];
var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][lastVisit.getMonth()];
var day = lastVisit.getDate();
var year = lastVisit.getFullYear();
var hour = lastVisit.getHours();
var minute = lastVisit.getMinutes();
var second = lastVisit.getSeconds();
SetCookie ("WWhenH", (new Date()).getTime(), exp)
return (dayOfWeek+", "+month+" "+day+", "+year+" at "+hour+":"+minute+":"+second);
}
function Count(info){
var WWHCount = GetCookie('WWHCount')
if (WWHCount == null) {
WWHCount = 0;
}
else{
WWHCount++;
}
SetCookie ('WWHCount', WWHCount, exp);
return WWHCount;
}
function set(){
VisitorName = prompt("Who are you?");
SetCookie ('VisitorName', VisitorName, exp);
SetCookie ('WWHCount', 0, exp);
SetCookie ('WWhenH', 0, exp);
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
document.write
alert("Hello " + Who() + ".");
alert(" You've been here " + Count() + " time(s).");
alert(" Your last visit was " + When() +".");
//-->
</SCRIPT>
and, this is also displayed like this:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
document.write("Hello " + Who() + ". You've been here " + Count() + " time(s). Last time was " + When() +".");
</SCRIPT>
now, how could i modify this so that it displays all the past users visits? in the alerts and the text display
if you could modify this code for me i would be most great full.
thank you in advance.