httml代码: 复制代码 代码如下: Untitled Document JS代码: 复制代码 代码如下: <BR><!-- <BR>function getCookie(name){ <BR>if(document.cookie.length > 0){ <BR>start = document.cookie.indexOf(name + "="); <BR>if( start != -1){ <BR>start = start +name.length + 1; <BR>end = document.cookie.indexOf(";",start); <BR>if( end == -1){ <BR>end = document.cookie.length; <BR>} <BR>return decodeURI(document.cookie.substring(start,end)); <BR>} <BR>} <BR>return ""; <BR>} <BR>function setCookie(name, value, expires, path, domain, secure){ <BR>var curcookie = name + "=" +encodeURI(value) <BR>+ ((expires) ? ";expires=" + expires.toGMTString() : "") <BR>+ ((path) ? ";path=" + path : "") <BR>+ ((domain) ? ";domain=" + domain : "") <BR>+ ((secure) ? ";secure" : ""); <BR>document.cookie = curcookie; <BR>} <BR>function start() { <BR>var text = ""; <BR>var visitorName = getCookie("VisitorName"); <BR>var lasttime = getCookie("time"); <BR>var isnMonth = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"); <BR>var isnDay = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); <BR>var today = new Date(); <BR>var year = today.getYear(); <BR>var day = today.getDate(); <BR>var cookietime = year + "年" + isnMonth[today.getMonth()] + day +"日" + isnDay[today.getDay()]; <BR>today.setTime(today.getTime() + 365*24*60*60*1000); <BR>setCookie("time",cookietime,today); <BR>if(visitorName =="") { <BR>visitorName = prompt("Input your name:"); <BR>setCookie("VisitorName",visitorName,today); <BR>document.write("Hello,"+ visitorName + "首次光臨本站,請多提寶貴意見"); <BR>} <BR>else { <BR>text += "Hello,"+ visitorName + "您是第 " + count() + "次訪問本站,<br>上次訪問時間為:" + lasttime; <BR>document.write(text); <BR>} <BR>} <BR>function count() { <BR>var now = new Date(); <BR>now.setTime(now.getTime() + 365*24*60*60*1000); <BR>var visits = getCookie("counter"); <BR>if( !visits ){ <BR>visits = 1; <BR>}else { <BR>visits = parseInt(visits) + 1; <BR>} <BR>setCookie("counter",visits,now); <BR>return visits; <BR>} <BR>--> <BR>