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

首頁 > 編程 > .NET > 正文

用ASP.NET實現一個簡單的計算器

2024-07-10 13:01:51
字體:
來源:轉載
供稿:網友


文件:
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"/>

文件:
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"/>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 敦化市| 肇州县| 博客| 罗山县| 塘沽区| 区。| 天长市| 梨树县| 涪陵区| 青海省| 哈密市| 来安县| 乐昌市| 格尔木市| 湘阴县| 石棉县| 海林市| 巍山| 栖霞市| 梁山县| 大余县| 盐城市| 鄂伦春自治旗| 仁布县| 房产| 遂平县| 图木舒克市| 苏尼特右旗| 青神县| 阳曲县| 安远县| 无棣县| 沙湾县| 京山县| 栾城县| 清新县| 阳泉市| 东乡县| 延津县| 聂拉木县| 龙山县|