国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

用ASP+實現一個簡單的計算器(適合入門者)

2019-11-18 21:54:32
字體:
來源:轉載
供稿:網友
廢話少說,直接進入主題.

文件:
Calculate.aspx
bin/Calculate.cs
bin/Calculate.bat

步驟:
1.Calculate.cs

namespace Calculate
{
using System;
public class math {

public String _color;
public int Add(int a,int b)
  {
     return a+b;
  }

public int Sub(int a,int b)
    {
       return a-b;
    }

public int Mul(int a,int b)
   {
     return a*b;
   }
public String Color
  {
   get {
     return _color;
       }
   set {
    _color=value;
       }
   }

  }
}

2.Calculate.bat

csc /t:library /out:Calculate.dll Calculate.cs

3.執行Calculate.bat

4.Calculate.aspx


<%@Import  NameSpace="Calculate"%>

<script language="c#" runat="server">
public String color;
void DoAdd(Object Src, EventArgs E)
{
math math=new math();
Message.Text=math.Add(Convert.ToInt32(A.Value),Convert.ToInt32(B.Value)).ToString();
math.Color=C.Value;
color=math.Color;

}

void DoSub(Object Src, EventArgs E)
{
math math=new math();
Message.Text=math.Sub(Convert.ToInt32(A.Value),Convert.ToInt32(B.Value)).ToString();
math.Color=C.Value;
color=math.Color;
}

void DoMul(Object Src, EventArgs E)
{
math math=new math();
Message.Text=math.Mul(Convert.ToInt32(A.Value),Convert.ToInt32(B.Value)).ToString();
math.Color=C.Value;
color=math.Color;

}

</script>
<font id=Cau color=<%Response.Write(color);%>>用ASP+寫得簡易計算器</font>
<form runat="server">

<input id="A" runat="server"/>
<input id="B" runat="server"/>
<input id="C" runat="server"/>
<asp:button Text="Add" OnClick="DoAdd" runat="server"/>
<asp:button Text="Sub" OnClick="DoSub" runat="server"/>
<asp:button Text="Mul" OnClick="DoMul" runat="server"/>
</form>
Result:<asp:label id=Message  runat="server"/>

5.總結
實在太爛,希望高手多多指教.(無限真誠)


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 和静县| 咸阳市| 玛沁县| 云和县| 乳山市| 文成县| 和田县| 如东县| 铜川市| 常熟市| 枝江市| 旅游| 正阳县| 西丰县| 株洲县| 毕节市| 罗城| 娱乐| 沿河| 板桥市| 灵石县| 抚顺市| 铜山县| 沙湾县| 定边县| 邛崃市| 肥城市| 安达市| 洮南市| 融水| 乐平市| 神池县| 鄂州市| 中宁县| 三亚市| 唐海县| 全椒县| 宜宾县| 桃江县| 定南县| 乌拉特后旗|