訪問回数の表示。
これは、僕自身が使用しているものです。 <HEAD>〜</HEAD>に挿入してから、 次の段に書いてあるプログラムを貴方の好きな場所へ挿入してください。
|
<SCRIPT Language="JavaScript"> <!----Cookie使用 var Ccount_name = "JSNCcount"; var Pre_date_name = "JSNPredate"; var CountV; var Pre_date; CountV = getCookie(Ccount_name); Date_string = getCookie(Pre_date); if (CountV == null || CountV == "null") { CountV = 0; } CountV = eval(CountV) + 1; set_count(CountV); Pre_date = getCookie(Pre_date_name); if (Pre_date == null) { Pre_date = 'はじめてのアクセスですね。'; } now = new Date( ); Date_string = "前回のアクセスは、"+now.getYear( )+"年"+(now.getMonth( )+1)+"月"+now.getDate( )+"日"+now.getHours( )+"時"+now.getMinutes( )+"分"+now.getSeconds( )+"秒"です。"; set_pre_date(Date_string); function setCookie(p_name,p_value,p_expires,p_path,p_domain,p_secure){ var v_text = ""; v_text = p_name + "=" + escape(p_value); if (p_expires){v_text = v_text + "; expires=" + p_expires.toGMTString();} if (p_path){v_text = v_text + "; path=" + p_path;} if (p_domain){v_text = v_text + "; domain=" + p_domain;} if (p_secure){v_text = v_text + ";" + p_secure;} document.cookie = v_text; } function getCookie(p_name) { if (document.cookie){ index = document.cookie.indexOf(p_name, 0); if (index != -1) { val_start = (document.cookie.indexOf("=", index) + 1); val_end = document.cookie.indexOf(";", index); if (val_end == -1){ val_end = document.cookie.length; } return(unescape(document.cookie.substring(val_start, val_end))); } } return(null); } function set_count(set_count_value){ var p_expires = new Date( ); p_value = set_count_value; p_expires.setTime(p_expires.getTime( ) + (6 * 30 * 24 * 60 * 60 * 1000)); p_expires = null; p_path = '/'; p_domain = null; p_secure = false; setCookie(Ccount_name,p_value,p_expires,p_path,p_domain,p_secure); } function set_pre_date(pre_date_value){ var p_expires = new Date(); p_value = pre_date_value; p_expires.setTime(p_expires.getTime( ) + (6 * 30 * 24 * 60 * 60 * 1000)); p_expires = null; p_path = '/'; p_domain = null; p_secure = false; setCookie(Pre_date_name,p_value,p_expires,p_path,p_domain,p_secure); } //END ---> </SCRIPT> |
書き終わったら、貴方の書きたい所で下のプログラムを <BODY>〜</BODY> の中へ書きます。
|
<SCRIPT Language="JavaScript"> <!---表示 document.write("<FONT COLOR=#ffffff size=2>" , CountV); document.write(" 回目です。有り難う御座いました。 </font>","<FONT COLOR=#ffffff size=2>" , Pre_date); //END ---> </SCRIPT> |
|
JavaScript |
TOP−画面 |