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

首頁 > 編程 > .NET > 正文

用ASP.NET實現(xiàn)一個簡單的計算器(適合入門者)

2024-07-10 13:07:56
字體:
供稿:網(wǎng)友

文件:
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.執(zhí)行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.執(zhí)行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"/>

轉(zhuǎn)自:動態(tài)網(wǎng)制作指南 www.knowsky.com
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 抚顺县| 聊城市| 湾仔区| 长泰县| 武汉市| 大厂| 奉新县| 和平县| 株洲县| 耿马| 漳州市| 通江县| 宕昌县| 措美县| 张家川| 葵青区| 张掖市| 屏东市| 湖北省| 柯坪县| 连江县| 德化县| 江阴市| 凤凰县| 呈贡县| 洮南市| 宜阳县| 德江县| 棋牌| 杭锦后旗| 武城县| 林州市| 土默特左旗| 凯里市| 竹山县| 芷江| 酒泉市| 博客| 壶关县| 宿松县| 奉新县|