vs2012ASP.net制作一个九九乘法表?

vs2012ASP.net制作一个九九乘法表?,第1张

我这个输入开始和结束可以生成某一区间段的,我这个是用VS2005开发的:
后台代码:
using System;
using SystemData;
using SystemConfiguration;
using SystemWeb;
using SystemWebSecurity;
using SystemWebUI;
using SystemWebUIWebControls;
using SystemWebUIWebControlsWebParts;
using SystemWebUIHtmlControls;
public partial class _Default : SystemWebUIPage
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
thislblshowResultText = "";
if (thistextNumAText == "" || thistextNumAText == "")
{
thislblshowResultText = "对不起,开始和结束不能为空!";
}
else
{
if (intParse(thistextNumAText) > intParse(thistextNumBText))
{
thislblshowResultText = "开始值不能大于结束值!";
}
else
{
if ((intParse(thistextNumAText) >= 1 && intParse(thistextNumAText) <= 9)
&&(intParse(thistextNumBText) >= 1 && intParse(thistextNumBText)<=9))
{
for (int i = intParse(thistextNumAText); i <= intParse(thistextNumBText); i++)
{
thislblshowResultText += "<br/>";
for (int j = intParse(thistextNumAText); j <= i; j++)
{
thislblshowResultText += i + "" + j + "=" + i j + " ";
}
}
}
else
{
thislblshowResultText = "开始值和结束值必须大于等于1小于等于9!";
}
}
}
}
catch (Exception)
{
thislblshowResultText = "对不起,开始和结束不能为空!";
}
}
}
网页代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Defaultaspxcs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 10 Transitional//EN" "
<html xmlns="
<head runat="server">
<title>九九乘法表</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table width="100%" align="center">
<tr>
<td colspan="5" style="color: red; text-align: center">九九乘法表</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td style="width: 173px"> <asp:Label ID="lblBegin" runat="server" Text="开始值:"></asp:Label></td>
<td style="width: 215px"> <asp:TextBox ID="textNumA" runat="server"></asp:TextBox></td>
<td style="width: 78px"> </td>
<td style="width: 339px"> <asp:Label ID="Label1" runat="server" Text="结束值:"></asp:Label></td>
<td style="width: 230px">
<asp:TextBox ID="textNumB" runat="server"></asp:TextBox> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5" style="text-align: center; height: 26px;"> <asp:Button ID="btnSubmit" runat="server" Text="提交" OnClick="btnSubmit_Click"/></td>
</tr>
</table>
</div>
<asp:Label ID="lblshowResult" runat="server" Height="251px" Width="731px"></asp:Label>
</form>
</body>
</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/10485652.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-09
下一篇 2023-05-09

发表评论

登录后才能评论

评论列表(0条)

保存