国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 古丈县| 余庆县| 阳朔县| 石狮市| 安图县| 合江县| 武邑县| 汝阳县| 依兰县| 兴山县| 思南县| 宁阳县| 建瓯市| 邹城市| 六安市| 蕉岭县| 寿光市| 繁昌县| 河间市| 邯郸县| 平南县| 长子县| 墨脱县| 河津市| 鹤山市| 昂仁县| 庆安县| 文昌市| 新兴县| 昌黎县| 政和县| 五指山市| 文山县| 兴化市| 驻马店市| 三江| 彰化市| 玉屏| 珲春市| 建昌县| 陵水|