WWeb程序的设计第3章课后题.docVIP

  • 2
  • 0
  • 约7.73千字
  • 约 9页
  • 2018-11-02 发布于福建
  • 举报
WWeb程序的设计第3章课后题

Web程序设计第3章课后题 注:课后题共7题(除第一题和第九题),其中5和8由于还有些问题没有解决,就没有将答案附上。这里的答案仅供参考,希望在上机之前能自己练习一下。程序有很多地方可以改,不要照搬。 (2)设计一个网页,其中包含TextBox和Button控件各一个。当在TextBox中输入一个成绩,再单击Button控件时在网页上输出相应的等级信息。 【.aspx】 %@ Page Language=C# AutoEventWireup=true CodeBehind=question2.aspx.cs Inherits=homework_chap3.question2 % !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN /TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=/1999/xhtml head runat=server title/title /head body form id=form1 runat=server div asp:TextBox ID=TextBox1 runat=server请输入一个成绩/asp:TextBox asp:Label ID=Label1 runat=server Text=Label待显示/asp:Label br / asp:Button ID=Button1 runat=server OnClick = btmSubmit_Click Text=检测 / /div /form /body /html 【.aspx.cs】 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace homework_chap3 { public partial class question2 : System.Web.UI.Page { protected void btmSubmit_Click(object sender, EventArgs e) { int iInput = int.Parse(TextBox1.Text); if (iInput 100) Label1.Text = 请输入正确的分数; else if(iInput = 90) Label1.Text = 优秀; else if (iInput = 80) Label1.Text = 良好; else if (iInput = 60) Label1.Text = 及格; else if (iInput = 0) Label1.Text = 不及格; else Label1.Text = 请输入正确的分数; } } } 【效果】 (3)在网页上输出九九乘法表 【.aspx.cs】(.aspx源文件可以不作处理) using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace homework_chap3 { public partial class question3 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { for (int i=1; i= 9; i++) { for (int j = 1; j = i; j++) { Resp

文档评论(0)

1亿VIP精品文档

相关文档