出来るのだASP Q&A掲示板(過去LOG)  訪問数 52046 昨日 889 今日 776
    【PR】 パソコン入門からIT専門書まで幅広く取り揃えています。セブン-イレブン受取り手数料無料のセブンアンドワイ。
Topに戻る 掲示板に戻る 検索 削除 管理者

[5583] calender仕上がりソースファイル 皆様ありがとうございました また勉強してきます
投稿者:さとしさん 2006/01/12 15:56:16
<%@ language=vbscript %>
<% Option Explicit %>
<html>
<head>
<title>カレンダー表示</title>
</head>
<body bgcolor="#f5f5f5">
<%
Dim ilastday
Dim idate
Dim Ttable
Dim Ytable
Dim iyear
Dim imonth
Const MINI_YEAR = 0
Const MAX_YEAR = 9999
Const MINI_MONTH = 1
Const MAX_MONTH = 12

'formからのpostがある場合と無い場合の切り分け
If Request.Form("year") = "" Then '入力データの取得 "年"
iyear = year(now)
Else
iyear = Request.Form("year")
End if
If Isnumeric(iyear) Then '入力値が整数であるか、また入力データが0〜9999であるか条件分岐
If MINI_YEAR > iyear and MAX_YEAR < iyear Then
iyear = year(now)
End if
else
iyear = Request.Form("year")

End if

If Request.Form("month") = "" Then '入力データの取得 "月"
imonth = month(now)
Else
imonth = Request.Form("month")
End if
If isnumeric(imonth) Then '入力値が整数であるか、また入力データが1〜12であるか条件分岐
If MINI_MONTH >= imonth and MAX_MONTH <= imonth Then
imonth = month(now)
End if
else
imonth = month(now)
End if

idate = 1-Weekday(Dateserial(iyear,imonth,1))+1 '週の一日目計算
ilastday = Day(Dateserial(iyear,imonth+1,1-1)) '月の最終日計算

Response.Write "<div>西暦" & iyear & "年" & imonth & "月</div>"

Response.Write "<table border=0>" 'テーブルの作成
Response.Write "<tr>"
For Ytable = 0 To 6 '曜日欄の作成 Weekdaynameで曜日を返していく
response.write "<td width=50 height=25 align=center>"
If (Weekday(Ytable) = 7) Then
Response.Write "<font color=red>"
End if
If (Weekday(Ytable) = 6) Then
Response.Write "<font color=blue>"
End If
Response.Write Weekdayname(Ytable+1,true)
Response.Write "</td>"
Next
Response.Write "</tr>"

For Ttable = 0 To 5 'カレンダ、月の1日目から月の最終日の表示
Response.Write "<tr>"
For Ytable = 0 To 6
If idate > 0 and idate <= ilastday Then 'カレンダに条件に見合った日付が入るかどうか
Response.Write "<td width=50 height=50 align=center>"
Select Case Ytable
Case 0
Response.Write "<font color=red>" & idate & "</font>"
Case 6
Response.Write "<font color=blue>" & idate & "</font>"
Case Else
Response.Write "<font color=black>" & idate & "</font>"
End Select
Response.Write "</td>"
Else
Response.Write "<td width=50 height=50 align=center>" & ""
Response.Write "</td>"
End If
idate = idate + 1 'カレンダの枠の中に該当した日付を入力していく
If idate > ilastday Then '繰り返し処理から抜け出す
Exit For
End If
Next
Response.Write "</tr>"
If idate > ilastday Then
Exit For
End If
Next
Response.Write "</table>"

Response.Write "今日は" & CDate(now())

%>
<form method = "post" action = "calender.asp"> <!-- 入力フォーム 年 月 -->
<input Type = "text" name = "year" size = "8" value = "<% response.write year(now) %>">年
<input Type = "text" name = "month" size = "4" value = "<% response.write month(now) %>">月
<input Type = "submit" value = "カレンダ表示" > <!-- フォームでsubmitしたらrequest.formに投げかける -->
</body>
</html>

カレンダ作成についてわからないことがあるのですが・・・   さとしさん [2006/01/10 17:38:09] [5564]
  初心者でめちゃくちゃですがよろしくお願いします   さとしさん [2006/01/10 17:40:44] [5565]
    Re:初心者でめちゃくちゃですがよろしくお願いします   ビギナーズラックさん [2006/01/10 22:11:55] [5566]
      Re:初心者でめちゃくちゃですがよろしくお願いします   さとしさん [2006/01/11 10:02:37] [5568]
    Re:初心者でめちゃくちゃですがよろしくお願いします   Lightningさん [2006/01/11 8:39:13] [5567]
      私ならこんな感じのソースにするかな?   Lightningさん [2006/01/11 10:04:30] [5569]
        Re:私ならこんな感じのソースにするかな?   Lightningさん [2006/01/11 10:35:42] [5573]
          Re:私ならこんな感じのソースにするかな?   さとしさん [2006/01/11 13:44:22] [5576]
            ソースファイルの書き方が下手くそですが・・・   さとしさん [2006/01/11 18:11:18] [5577]
              Re:ソースファイルの書き方が下手くそですが・・・   ビギナーズラックさん [2006/01/11 23:37:16] [5578]
                Re:ソースファイルの書き方が下手くそですが・・・   さとしさん [2006/01/12 9:08:48] [5579]
              Re:ソースファイルの書き方が下手くそですが・・・   Lightningさん [2006/01/12 9:39:48] [5580]
                Re:ソースファイルの書き方が下手くそですが・・・   さとしさん [2006/01/12 13:57:49] [5581]
                  Re:ソースファイルの書き方が下手くそですが・・・   Lightningさん [2006/01/12 15:41:35] [5582]
      Re:初心者でめちゃくちゃですがよろしくお願いします   さとしさん [2006/01/11 10:08:08] [5570]
        Re:初心者でめちゃくちゃですがよろしくお願いします   Lightningさん [2006/01/11 10:14:00] [5571]
          Re:初心者でめちゃくちゃですがよろしくお願いします   さとしさん [2006/01/11 10:20:42] [5572]
          Re:初心者でめちゃくちゃですがよろしくお願いします   ビギナーズラックさん [2006/01/11 13:16:24] [5574]
            Re:初心者でめちゃくちゃですがよろしくお願いします   さとしさん [2006/01/11 13:36:10] [5575]
              calender仕上がりソースファイル 皆様ありがとうございました また勉強してきます   さとしさん [2006/01/12 15:56:16] [5583]


TreeBBS For ASP V.0.1.3
Program By YasNet