首頁
程式語言
工具下載
學習範例
技術專區
相關書籍
原始碼程式範例
好站相報
技術論壇
易尋網
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 Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) If TextBox1.Text = "" Then Label1.Text = "請輸入A值...." Exit Sub Else If Not IsNumeric(TextBox1.Text) Then Label1.Text = "A值必須是數字...." Exit Sub End If End If If TextBox2.Text = "" Then Label2.Text = "請輸入B值...." Exit Sub Else If Not IsNumeric(TextBox1.Text) Then Label2.Text = "B值必須是數字...." Exit Sub End If End If Label3.Text = TextBox1.Text + TextBox2.Text End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) If TextBox1.Text = "" Then Label1.Text = "請輸入A值...." Exit Sub Else If Not IsNumeric(TextBox1.Text) Then Label1.Text = "A值必須是數字...." Exit Sub End If End If If TextBox2.Text = "" Then Label2.Text = "請輸入B值...." Exit Sub Else If Not IsNumeric(TextBox1.Text) Then Label2.Text = "B值必須是數字...." Exit Sub End If End If Label3.Text = TextBox1.Text - TextBox2.Text End Sub Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) If TextBox1.Text = "" Then Label1.Text = "請輸入A值...." Exit Sub Else If Not IsNumeric(TextBox1.Text) Then Label1.Text = "A值必須是數字...." Exit Sub End If End If If TextBox2.Text = "" Then Label2.Text = "請輸入B值...." Exit Sub Else If Not IsNumeric(TextBox1.Text) Then Label2.Text = "B值必須是數字...." Exit Sub End If End If Label3.Text = TextBox1.Text * TextBox2.Text End Sub Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) If TextBox1.Text = "" Then Label1.Text = "請輸入A值...." Exit Sub Else If Not IsNumeric(TextBox1.Text) Then Label1.Text = "A值必須是數字...." Exit Sub End If End If If TextBox2.Text = "" Then Label2.Text = "請輸入B值...." Exit Sub Else If Not IsNumeric(TextBox1.Text) Then Label2.Text = "B值必須是數字...." Exit Sub End If End If Label3.Text = TextBox1.Text / TextBox2.Text End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>未命名頁面</title> </head> <body> <form id="form1" runat="server"> <div> <table width="400"> <tr> <td align="right" style="width: 100px"> A</td> <td style="width: 203px"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td> <td style="width: 71px"> <asp:Label ID="Label1" runat="server" Width="110px" ForeColor="Red"></asp:Label></td> </tr> <tr> <td align="right" style="width: 100px"> B</td> <td style="width: 203px"> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td> <td style="width: 71px"> <asp:Label ID="Label2" runat="server" ForeColor="Red" Width="110px"></asp:Label></td> </tr> <tr> <td style="width: 100px"> </td> <td style="width: 203px"> <asp:Label ID="Label3" runat="server" Text="0" Width="119px"></asp:Label></td> <td style="width: 71px"> </td> </tr> <tr> <td align="center" colspan="3"> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text=" + " /> <asp:Button ID="Button2" runat="server" Text=" - " OnClick="Button2_Click" /> <asp:Button ID="Button3" runat="server" Text=" * " OnClick="Button3_Click" /> <asp:Button ID="Button4" runat="server" Text=" / " OnClick="Button4_Click" /></td> </tr> </table> <br /> </div> </form> </body> </html>
1. 請點選此處複製以上資料
2. 請按
ctrl-c
複製到剪貼簿
3. 切換到ASP的原始內碼區
4. 請按
ctrl-v
貼上所有資料