JavaScript Page /Include/MasterPage.js (VB.NET)
1: function SetCookies() {
2: var timeOffset = getCookie("TimeZoneOffset");
3: var clientTime = getCookie("ClientTime");
4: if (timeOffset == null || timeOffset == "" || clientTime == null || clientTime == "") {
5: setCookie("TimeZoneOffset", getUtcOffset(), 1);
6: setCookie("ClientTime", (new Date()).format('dd/MM/yyyy HH:mm:ss'), 1);
7: //window.location.reload();
8: }
9: }
10:
11: function getCookie(cookieName) {
12: if (document.cookie.length > 0) {
13: cookieStart = document.cookie.indexOf(cookieName + "=");
14: if (cookieStart != -1) {
15: cookieStart = cookieStart + cookieName.length + 1;
16: cookieEnd = document.cookie.indexOf(";", cookieStart);
17: if (cookieEnd == -1) cookieEnd = document.cookie.length;
18: return unescape(document.cookie.substring(cookieStart, cookieEnd));
19: }
20: }
21: return "";
22: }
23:
24: function setCookie(cookieName, cookieValue, expiredays) {
25: var exdate = new Date();
26: exdate.setDate(exdate.getDate() + expiredays);
27: document.cookie = cookieName + "=" + escape(cookieValue) + ((expiredays == null) ? "" : ";expires=" + exdate.toUTCString());
28: }
29:
30: function getUtcOffset() {
31: return (new Date()).getTimezoneOffset();
32: }

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.