LoginSignup
15
16

More than 5 years have passed since last update.

JavaScript、「New」表示

Posted at

JavaScript、「New」表示

■about

JavaScript、「New」表示

■code

JavaScript
// 一定期間New/Upマークを表示する
function newUp(y, m, d, c) {
  delDay = 7; // 何日後に削除するか
  oldDay = new Date(y + "/" + m + "/" +d);
  newDay = new Date();
  d =(newDay - oldDay) / (1000 * 24 * 3600);
  if(d <= delDay) {
    // Newマーク
    if(c == "new") document.write("<img src='http://crm.synergy101.jp/wordpress/wp-content/themes/synergy-crm/img/icon_new.gif' style='vertical-align:baseline;'>");
  }
}
html
//実行場所に記述
<script type="text/javascript">newUp(2014,5,1,"new")</script>
15
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
16