首頁
程式語言
工具下載
學習範例
技術專區
相關書籍
原始碼程式範例
好站相報
技術論壇
易尋網
ASP空間租賃
汽車追蹤的第一個家
弘光科技大學
南開技術學院
巨匠電腦
買賣購物網
Life Light
遠距醫療網
清境民宿珂之幄
原始程式碼
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim Birth As Date Birth = Calendar1.SelectedDate TextBox1.Text = Calendar1.SelectedDate Dim Y As Integer Dim M As Integer M = DateDiff("m", Birth, Now()) Y = M \ 12 M = M Mod 12 Label2.Text = Y & "歲" & M & "月" & WeekdayName(Weekday(Birth)) 'Label2.Text = DateDiff("yyyy", Birth, Now()) & " " & Weekday(Birth) End Sub Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim Birth As Date If TextBox1.Text = "" Then MsgBox("請輸入生日!!", 48, "輸入項") Exit Sub Else If Not IsDate(TextBox1.Text) Then MsgBox("請輸入正確的生日!!", 48, "輸入項") Exit Sub End If End If Birth = TextBox1.Text Dim Y As Integer Dim M As Integer M = DateDiff("m", Birth, Now()) Y = M \ 12 M = M Mod 12 Label2.Text = Y & "歲" & M & "月" & WeekdayName(Weekday(Birth)) If Y >= 18 Then Response.Write("限制級") Else If Y >= 12 Then Response.Write("輔導級") Else Response.Write("一般級") End If End If End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>未命名頁面</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#3366CC" BorderWidth="1px" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="#003399" Height="200px" OnSelectionChanged="Calendar1_SelectionChanged" Width="220px"> <SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" /> <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" /> <WeekendDayStyle BackColor="#CCCCFF" /> <TodayDayStyle BackColor="#99CCCC" ForeColor="White" /> <OtherMonthDayStyle ForeColor="#999999" /> <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" /> <DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" /> <TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" /> </asp:Calendar> </div> <asp:Label ID="Label1" runat="server" Text="生日"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox> <br /> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> </form> </body> </html>
1. 請點選此處複製以上資料
2. 請按
ctrl-c
複製到剪貼簿
3. 切換到ASP的原始內碼區
4. 請按
ctrl-v
貼上所有資料