*

次の月曜日を取得

公開日: : 最終更新日:2015/05/11 WEB

var arr = Array( "日","月","火","水","木","金","土" );
function GetNextMonday(){
  //参考
  
  var today = new Date();
  var todayWeek = today.getDay(); //曜日の番号取得
  var fowardDay = 24;//月曜日まであと何日か
  
  var nowDate = new Date();
  var nextMonday = new Date(nowDate.getTime() + fowardDay*24*60*60*1000);
  var nextMondayText = nextMonday.getFullYear() + "-" + (nextMonday.getMonth() + 1) + "-" +  nextMonday.getDate() + " (" + arr[1] + ")";
  $("input").val(nextMondayText);
}
function ShowDayList(){
  var dayhtml = "";
  var today = new Date();
  var nextdayText = "";

  for (var i=1 ; i<=7 ; i++){
    var nextday = new Date(today.getTime() + i*24*60*60*1000);
    nextdayText = nextday.getFullYear() + "-" + (nextday.getMonth() + 1) + "-" +  nextday.getDate() + " (" + arr[nextday.getDay()] + ")";
    dayhtml += "<li>" + nextdayText + "</li>";
  }
  $("ul").append(dayhtml);
}
function ShowNextWeekDayList(){
  $("ul").empty();
  var dayhtml = "";
  var today = new Date();
  var nextdayText = "";
  var n = parseInt($(this).text(),10);
  for (var i=7*n -1 ; i<=7*n + 5 ; i++){
    var nextday = new Date(today.getTime() + i*24*60*60*1000);
    nextdayText = nextday.getFullYear() + "-" + (nextday.getMonth() + 1) + "-" +  nextday.getDate() + " (" + arr[nextday.getDay()] + ")";
    dayhtml += "<li>" + nextdayText + "</li>";
  }
  $(this).empty();
  var htmlElement = "<p class=\"disnon\">" + (n+1) + "</p>next week";
  $(this).append(htmlElement);
  $("ul").append(dayhtml);
  $(this).one("click",ShowNextWeekDayList);
}
$(document).ready(function() {
  $("div#b").one("click",GetNextMonday);
  $("div#c").one("click",ShowDayList);
  $("div#d").one("click",ShowNextWeekDayList);
});

admax_area



関連記事

no image

gg

http://www.webcreatorbox.com/tech/accessible-drop-

記事を読む

no image

call

<?php $array[] = $_POST['name']; $array[] =

記事を読む

no image

sample.js

$.post('<?php print($url); ?>',object) .

記事を読む

no image

tableedit

http://ginpen.com/2012/05/21/how-to-get-values-fro

記事を読む

no image

index.php

<head> <link rel="stylesheet"

記事を読む

no image

main.php

<?php include 'script_load.php';//css、script

記事を読む

no image

script-load.php

<head> <link rel="stylesheet&qu

記事を読む

no image

table

<table> <thead> </thead> &l

記事を読む

no image

sample.php

MySQLのクエリログを保存するには、 Windows(Xampp)の場合は「C:\xampp\m

記事を読む

no image

tmp

http://pulseapp.com/ http://www.smashingmagazine.

記事を読む

admax_area



Message

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA


日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)

PREV
tableedit
NEXT
sql

admax_area



PAGE TOP ↑