150 likes | 230 Views
簡易 Asp(Active Serve Pages). 簡易 Asp(Active Serve Pages) 程式 <HTML> <HEAD><TITLE>Hello World!!</TITLE></HEAD> <BODY> <% ' 將 Hello World!! 以紅色輸出 Response.Write "<FONT Size = 4 Color = Red> Hello World!!</FONT>" Response.Write " 現在時間是 " Response.Write Date ' 使用 Date 函數取得目前的系統時間 %> </BODY>
E N D
簡易Asp(Active Serve Pages) 程式 <HTML> <HEAD><TITLE>Hello World!!</TITLE></HEAD> <BODY> <% '將Hello World!!以紅色輸出 Response.Write "<FONT Size = 4 Color = Red> Hello World!!</FONT>" Response.Write "現在時間是" Response.Write Date '使用Date函數取得目前的系統時間 %> </BODY> </HTML>
簡易Asp(Active Serve Pages) 程式 <HTML> <HEAD><TITLE>Hello World!!</TITLE></HEAD> <BODY> <FONT Size = 4 Color = Red> Hello World!!</FONT> 現在日期是 <% = Date %> </BODY> </HTML>
簡易Asp(Active Serve Pages) 程式 <% A = 7 '設定A、B變數值 B = 2 %> <CENTER> <FONT SIZE = 5 COLOR = BLUE>算術運算子的使用</FONT> </CENTER> <HR> 下列算式中<FONT COLOR = RED >A = <% = A %>, B = <% = B %> </FONT> <PRE>加法運算: A + B = <% = A + B %> 減法運算: A - B = <% = A - B %> 乘法運算: A * B = <% = A * B %> 除法運算: A / B = <% = A / B %> 整數除法: A \ B = <% = A \ B %> 指數運算: A ^ B = <% = A ^ B %> 取餘數 : A MOD B = <% = A MOD B %> </PRE>
簡易Asp(Active Serve Pages) <HTML> <HEAD> <TITLE>單一條件判斷敘述的使用</TITLE> </HEAD> <BODY> <CENTER> <FONT SIZE = 5 COLOR = BLUE>單一條件判斷敘述的使用</FONT> </CENTER> <HR> <BR> <FONT COLOR = Red SIZE = 4>單一條件式控制單一程式敘述的執行</FONT> <BR> <% A = 100 Response.Write "A = " & A if A > 10 then Response.Write ",大於10" end if %>
簡易Asp(Active Serve Pages) <P></P> <FONT COLOR = Red SIZE = 4>單一條件式控制兩程式敘述的執行</FONT> <BR> <% A = 8 Response.Write "A = " & A if A > 10 then Response.Write ",大於10" else Response.Write ",小於10" end if %> </BODY> </HTML>
簡易Asp(Active Serve Pages) <FONT SIZE = 5 COLOR = BLUE>多條件判斷敘述的使用</FONT> </CENTER> <HR> <P></P> <% A = 100 Response.Write "A = " & A if A < 10 then Response.Write ",小於10" elseif A >= 10 And A <= 100 then Response.Write ",介於10與100之間" else Response.Write ",大於100" end if %>
簡易Asp(Active Serve Pages) <% theyear = 2130 '設定欲判斷之年 Response.Write "西元<FONT COLOR = RED>" & theyear & "</FONT>年, " If theyear Mod 4 = 0 Then '可被4除盡 If theyear Mod 100 = 0 Then '可被4、100除盡 If theyear Mod 400 = 0 Then '可被4、100、400除盡 Response.Write "這一年是閏年!" Else '可被4、100除盡 ,不可被400除盡 Response.Write "這一年不是閏年!" End If Else '可被4除盡, 不可被100除盡 Response.Write "這一年閏年!" End if Else '不可被4除盡 Response.Write "這一年不是閏年!" End if %>
簡易Asp(Active Serve Pages) Do...Loop While迴圈的執行 <% i = 1 N = 1 '雖然判斷條件式為假, 但下面迴圈內的敘述仍會被執行一次 Do Response.Write "迴圈第" & i & "次被執行" i = i + 1 Loop While N = 0 %>
簡易Asp(Active Serve Pages) <FONT SIZE = 5 COLOR = BLUE>Do While...Loop迴圈的應用</FONT> </CENTER> <HR> <P></P> <% i = 1 '設定起始值 Sum = 0 Do While i <= 99 Sum = Sum + i '執行累加動作 i = i + 2 '增加 i 值 Loop Response.Write "1到99的奇數總合為<FONT COLOR = RED>" & Sum Response.Write "</FONT>" '輸出計算結果 %>