記住你是誰

將下列程式碼複製至<head>程式碼</head>區內

<script language="JavaScript">
<!-- Hide from older browers
var pham = document.cookie;

function getCookie(name) {
name += "="; // append '=' to name string
var i = 0; // index of first name=value pair
while (i < pham.length) {
var offset = i + name.length; // end of section to compare with name string
if (pham.substring(i, offset) == name) { // if string matches
var endstr = pham.indexOf(";", offset); // locate end of name=value pair
if (endstr == -1) endstr = pham.length;
return unescape(pham.substring(offset, endstr)); // return cookie value section
}
i = pham.indexOf(" ", i) + 1; // move i to next name=value pair
if (i == 0) break; // no more values in cookie string
}
return null; // cookie not found
}

var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000);

var headCount = getCookie("headCount") || 1;
var userName = getCookie("userName") || prompt("ps . 一定要輸入暱稱才會計算到訪的次數....◤請輸入您的暱稱譬如◢ : ", "【大哥】");
if (userName == null || userName == "")
userName = "Anonymous";

if (headCount == 1) alert("歡迎您的到來.., ◣" + userName + "◥, 這是您第一次光臨 【鄉城風情網站】!!"); //change greeting as required
else if (headCount == 2) alert("嗨.., ◤◤" + userName + "◢◢, 這可是您第二次光臨本站喔!!");
else alert("您又在一次的光臨本站 ◤" + userName + "◢ 您已經來了 【" + headCount + "】 次..是不是在找資料ㄚ!");

document.cookie = "headCount=" + (++headCount) + "; expires=" + expiry.toGMTString();
document.cookie = "userName=" + escape(userName) + "; expires=" + expiry.toGMTString();

// Stop hiding -->
</script>