- 2010-03-20 (土) 17:53
- HTML/CSS | JavaScript | アフィリエイト全般
小ネタです。
よく、商材のランディングページ冒頭に「日付」が入ってたりしますが、
あれってタイムリー性を出すためにユーザさんがそのページを見ている
まさに「その日」で表示されていますよね?
あれ、JavaScriptをランディングページに埋め込んで実装します。
サンプルコードは以下のとおりです。
<SCRIPT LANGUAGE="JavaScript">
<!--
daydate=new Date();
Ye=daydate.getFullYear()+"年";
Mo=daydate.getMonth()+1+"月";
Da=daydate.getDate()+"日";
Day=daydate.getDay();
YOUBI=new Array(7);
YOUBI[0]="日";YOUBI[1]="月";YOUBI[2]="火";
YOUBI[3]="水";YOUBI[4]="木";YOUBI[5]="金";
YOUBI[6]="土";
document.write(""+Ye+Mo+Da+"");
//-->
</SCRIPT>
もしくは以下でもOKです。
<script language="JavaScript">
<!--
//曜日の配列を作成
weeks = new Array("日","月","火","水","木","金","土");
//日付の取得
today = new Date();
year = today.getFullYear();
mon = today.getMonth() + 1;
date = today.getDate();
day = weeks[today.getDay()];
//日付を表示
document.write(year,"年",mon,"月",date,"日(",day,")");
//-->
</script>
コメント:0
トラックバック:0
- このエントリーのトラックバックURL
- http://affiliate-hacks.com/archives/143/trackback
- Listed below are links to weblogs that reference
- 今日の日付を表示する/JavaScript from Affiliate-Hacks