|
出来るのだASP Q&A掲示板(過去LOG)
訪問数 52046
昨日 889
今日 776 【PR】 パソコン入門からIT専門書まで幅広く取り揃えています。セブン-イレブン受取り手数料無料のセブンアンドワイ。 |
Topに戻る
掲示板に戻る
検索
削除
管理者
|
| [5570] Re:初心者でめちゃくちゃですがよろしくお願いします |
| 投稿者:さとしさん 2006/01/11 10:08:08 |
| > ソース上の改善点はいろいろありますが、質問への回答は > if request("year")="" then > iyear = year(now) > else > iyear =request("year") > end if > こういうことだと思いますが・・・ > なお、メソッドがpost固定で決まっているのならrequestはrequest.formを使ったほうがいいです。 > > request.formはformのmethodがpostの場合に使います。 > request.form("year")とかって感じに。 > > で、改善点ですが・・・ > > if Yhyo = 0 then > response.write "<font color=red>" & hiduke & "</font>" > end if > if Yhyo = 6 then > response.write "<font color=blue>" & hiduke & "</font>" > end if > if Yhyo = 1 then > response.write "<font color=black>" & hiduke & "</font>" > end if > if Yhyo = 2 then > response.write "<font color=black>" & hiduke & "</font>" > end if > if Yhyo = 3 then > response.write "<font color=black>" & hiduke & "</font>" > end if > if Yhyo = 4 then > response.write "<font color=black>" & hiduke & "</font>" > end if > if Yhyo = 5 then > response.write "<font color=black>" & hiduke & "</font>" > end if > は > select case Yhyo > case 0: > response.write "略" > case 6: > response.write "略" > case else: > response.write "略" > end select > って感じにしてしまうとか、いろいろ考えられると思います。 > #もしかしたらJSなどのswitchの書式と混ざっている可能性があるのでselectCaseに関しては使用前に確認してください。 Lightningさん回答ありがとうございました。 select文ですっきとさせました。実際にrequest.form("year")とrequest("month")というのを宣言の上に付け足したのですが、特になにも起こりませんでした。すごい初歩的かもしれませんが、もう一歩ご指摘願いますでしょうか。よろしくお願いします。失礼しました。 <%@ language=vbscript %> <% option explicit %> <html> <head> <title>カレンダー表示</title> </head> <body bgcolor="#f5f5f5"> <% '================================ '入力データの取得 '================================ request.form("year") request.form("month") dim saisyuubi dim hiduke dim Thyo dim Yhyo dim iyear dim imonth iyear = year(now) imonth= month(now) '================================ '日付の週の一日目と月の末、作成 '================================ hiduke = 1-weekday(dateserial(iyear,imonth,1))+1 saisyuubi = day(dateserial(iyear,imonth+1,1-1)) response.write "西暦" & iyear & "年" & imonth & "月" &_ "<table border=0>" for Yhyo = 0 to 6 response.write "<td width=50 height=25 align=center>" if (weekday(Yhyo) = 7) then response.write "<font color=red>" end if if (weekday(Yhyo) = 6) then response.write "<font color=blue>" end if response.write weekdayname(Yhyo+1,true) response.write "</td>" next '================================= 'カレンダ本体、1〜7日で折り返して '作成。 '================================= for Thyo = 0 to 5 response.write "<tr>" for Yhyo = 0 to 6 if hiduke > 0 and hiduke <= saisyuubi then response.write "<td width=50 height=50 align=center>" 'select文ですっきりと select case Yhyo case 0 response.write "<font color=red>" & hiduke & "</font>" case 6 response.write "<font color=blue>" & hiduke & "</font>" case else response.write "<font color=black>" & hiduke & "</font>" end select response.write "</td>" else response.write "<td width=50 height=50 align=center>" & "" response.write "</td>" end if hiduke = hiduke + 1 if hiduke > saisyuubi then exit for end if next response.write "</tr>" if hiduke > saisyuubi 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 = "カレンダ表示" > </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 |