Wednesday, September 5, 2007

Counter

Welcome back!




Note:
The name of the cookie is "myHits". The expiration date is input as 30 x 24 x 60 x 60 x 1000ms. You can manually delete this page counter cookie by the management tool of browser. Locate and select the host name ecmtang.blogspot.com to delete.

When testing the script, I find that Safari does not accept cookie from local host (with no host name). So the counter works only when the page is loaded from the internet.



codes:

newDate.setTime(newDate.getTime()+2592000000);
/* set cookie expiration date

setCookie("myHits", newCount, newDate, false, false, false);
/* set cookie

A JavaScript function setCookie(name,value,expires,path,domain,secure)
has been added to <head> of the template of the blog page.