六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網(wǎng)中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

剛學ASP.Net,學了個容易的計算器

[摘要]<html> <head> <title>Calculator</title> <script language="vb" Runat="server"> dim c as ch...

<html>
  <head>
    <title>Calculator</title>
    <script language="vb" Runat="server">
    dim c as char
    dim str as string
    dim len as integer
    dim Is2 as Boolean
    dim num1 as double
    dim num2 as double
    dim result as double
 '**************************************************
   Sub btClick(Sender as Object , E as EventArgs)
     If(Sender.Equals(btResult)) Then
        Len = LoadStr.Text.Length()
        If(Len = 0) Then  Exit Sub
        Len = LoadStr.Text.Length()
        c = Right(LoadStr.Text,1)
        str = Left(LoadStr.Text,Len-1)
        num1 = Val(str)
        num2 = Val(tbExps.Text)
        result = num2
        Select Case Asc(c)
          Case 43
            result = num1 + num2
          Case 45
            result = num1 - num2
          Case 42
            result = num1 * num2
          Case 47
            If(num2 = 0) Then
              tbExps.Text = "除數(shù)不可以為零"
              Exit Sub
            End If
            result = num1/num2
        End Select
        str = CStr(result)
        Ltrim(str)
        tbExps.Text = str 
        LoadStr.Text = "" 
     End If
'**************************************************
     If(Sender.Equals(btAdd)) Then
       LoadStr.Text = tbExps.Text + "+"
       tbExps.Text = ""
     End If 
'**************************************************
    If(Sender.Equals(btMin)) Then
      LoadStr.Text = tbExps.Text + "-"
      tbExps.Text = ""
    End If
'**************************************************
    If(Sender.Equals(btMul)) Then
      LoadStr.Text = tbExps.Text + "*"
      tbExps.Text = ""
    End If
'**************************************************
    If(Sender.Equals(btDiv)) Then
      LoadStr.Text = tbExps.Text + "/"
      tbExps.Text =""
    End If
'**************************************************
     If(Sender.Equals(btCls)) Then
       tbExps.Text = ""
     End If
 '**************************************************
     If(Sender.Equals(btBack)) Then
      If(tbExps.Text.Length() <> 0) Then
       str = tbExps.Text
       len = tbExps.Text.Length()
       tbExps.Text = Left(str,len-1)
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt)) Then
       If(Left(tbExps.Text,1) = "-") Then
         str = tbExps.Text
         len = tbExps.Text.Length()
         tbExps.Text = Right(str,len-1)
       Else
         str = "-"
         str += tbExps.Text
         tbExps.Text = str
       End If
     End If
 '**************************************************
     If(Sender.Equals(btDot)) Then
       If(tbExps.Text.Length() <> 0) Then
        If(tbExps.Text.Length() <10) Then
         tbExps.Text += "."
        End If
       End If
     End If
 '**************************************************
     If(Sender.Equals(bt1)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "1"
       Else
         tbExps.Text += "1"
       End If
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt2)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "2"
       Else
         tbExps.Text += "2"
       End If
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt3)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "3"
       Else
         tbExps.Text += "3"
       End If
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt4)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "4"
       Else
         tbExps.Text += "4"
       End If
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt5)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "5"
       Else
         tbExps.Text += "5"
       End If
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt6)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "6"
       Else
         tbExps.Text += "6"
       End If
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt7)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "7"
       Else
         tbExps.Text += "7"
       End If
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt8)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "8"
       Else
         tbExps.Text += "8"
       End If
      End If
     End If
 '**************************************************
     If(Sender.Equals(bt9)) Then
      If(tbExps.Text.Length() <10) Then
       If(tbExps.Text = "0") Then
         tbExps.Text = "9"
       Else
         tbExps.Text += "9"
       End If
      End If
     End If
 '**************************************************
        If(Sender.Equals(bt0)) Then
         If(tbExps.Text.Length() <10) Then
          If(tbExps.Text <> "0") Then
            tbExps.Text += "0"
          End If
         End If
        End If
         
   End Sub 
'****************************************************
   Sub Help(Sender as Object, E as EventArgs)
     if(lbHelp.visible) Then
       lbHelp.visible = False
     Else
        lbHelp.visible = True
     End if
   End Sub
    </script>
  </head>
 
  <body MS_POSITIONING="GridLayout">
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;簡單計算器
    <form id="Form1" method="post" runat="server">
    <asp:panel id="Pl" Runat="server" Width=200 Height=220 BorderStyle="Solid" BorderColor="#ffcc33" BackColor="#ccffff">
     <hr>
     <asp:textbox id=tbExps MaxLength="10" Width=195 Runat="server" TextAlign="Right"/>
     <hr>
     <asp:label Runat="server" width=5/>
     <asp:button id=btCls Text="Clear" Width=60 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=btBack Text="Back" Width=60 Height=25 Runat="server" OnClick="btClick"/>
     <asp:label Width=25 Runat="server"/>
     <asp:button id=btResult Text="=" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <hr>
    
    
     <asp:label Runat="server" width=5/>
     <asp:button id=bt7 Text="7" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=bt8 Text="8" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=bt9 Text="9" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:label Width=50 Runat="server"/>
     <asp:button id=btMul Text="*" Width=30 Height=25 Runat="server" OnClick="btClick"/>
    
    
     <asp:label Runat="server" width=5/>
     <asp:button id=bt4 Text="4" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=bt5 Text="5" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=bt6 Text="6" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:label Width=50 Runat="server"/>
     <asp:button id=btDiv Text="/" Width=30 Height=25 Runat="server" OnClick="btClick"/>
  
     <asp:label Runat="server" width=5/>
     <asp:button id=bt1 Text="1" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=bt2 Text="2" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=bt3 Text="3" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:label Width=50 Runat="server"/>
     <asp:button id=btAdd Text="+" Width=30 Height=25 Runat="server" OnClick="btClick"/>
    
    
     <asp:label Runat="server" width=5/>
     <asp:button id=bt0 Text="0" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=bt Text="-/+" Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:button id=btDot Text="." Width=30 Height=25 Runat="server" OnClick="btClick"/>
     <asp:label Width=50 Runat="server"/>
     <asp:button id=btMin Text="-" Width=30 Height=25 Runat="server" OnClick="btClick"/>
    </asp:panel>
    <br>
    <asp:Label id=LoadStr runat="server" Visible=False />
    <asp:button id=btHelp runat="server" Text="使用幫助==>>" OnClick="Help"/><br>
    <asp:label id=lbHelp  Visible=False wrap=True Runat="server" Text = "這是一個簡單的計算器,實現(xiàn)的功能很簡單。可以運算四則運算,包括小數(shù),負數(shù)等。輸入時最多只能為10位數(shù)。謝謝大家的使用,有什么建議可以聯(lián)系我."/>
    </form>

  </body>
</html>


 





主站蜘蛛池模板: 特黄特色的免费大片看看 | 天堂中文在线观看 | 日韩孕交| 日本高清天码一区在线播放 | 亚洲乱亚洲23p女 | 亚洲精品在线视频观看 | 青娱乐在线观看 | 日本天堂在线视频 | 日韩欧美一卡二区 | 天堂v亚洲国产v一区二区 | 天天做天天爱夜夜爽毛片毛片 | 亚洲视频1区| 天天色天天干天天 | 人人干狠狠操 | 亚洲 欧美 日韩中文字幕一区二区 | 日韩中文字幕免费观看 | 视频免费1区二区三区 | 婷婷丁香六月 | 欧洲亚洲一区二区三区 | 日本视频在线观看播放免费 | 日本高清免费不卡在线 | 青春草在线观看 | 欧美性生交xxxxx久久久 | 欧美一级黄色录像 | 香蕉香蕉国产片一级一级毛片 | 四虎影院在线观看网站 | 永久免费毛片 | 欧美在线一区二区 | 中文字幕字幕乱码熟 | 又爽又黄无遮挡高清免费视频 | 天天干夜夜躁 | 亚洲码和乱人伦中文一区 | 在线看91 | 欧美一级欧美三级在线观看 | 性生活一区| 日韩一区二区三区不卡视频 | 亚洲九色 | 无码中文字幕乱在线观看 | 午夜色视频在线观看 | 色噜噜在线观看 | 欧美又大粗又爽又黄大片视频黑人 |