第一范文网 - 专业文章范例文档资料分享平台

动态网页设计实训指导书

来源:用户分享 时间:2025/5/31 5:14:29 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

}

}

任务三:

设计一个小计算器,能够进行基本的加,减,乘,除运算即可,程序运行效果如图:

具体操作步骤: 1.建立网站: 2.设计页面:

3.添加控件及设置属性: 4.编写事件代码:

using System;

using System.Configuration; using System.Data; using System.Linq; using System.Web;

using System.Web.Security; using System.Web.UI;

using System.Web.UI.HtmlControls; using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts; using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e)

{

this.Title = \我的小计算器\ txtresult.ReadOnly = true;

14

}

protected void Button1_Click(object sender, EventArgs e) {

float fnum1 = 0, fnum2 = 0, fresult = 0; fnum1 = float.Parse(txtnum1.Text); fnum2 = float.Parse(txtnum2.Text);

string strope = dropclass.SelectedValue; switch (strope) {

case \

fresult = fnum1 + fnum2; break; case \

fresult = fnum1 - fnum2; break; case \

fresult = fnum1 * fnum2; break; case \

fresult = fnum1 / fnum2; break; }

txtresult.Text = fresult.ToString(); }

protected void Button2_Click(object sender, EventArgs e) {

txtnum1.Text = \ txtnum2.Text = \ txtresult.Text = \ }

}

任务四:

制作如图所示的用户注册页面,当单击“注册”按钮后就在Label控件中显示相应注册信息,当单击“重置”按钮后所有的信息清空。

15

具体操作步骤: 1.建立网站: 2.设计页面:

3.添加控件及设置属性: 4.编写事件代码:

using System;

using System.Configuration; using System.Data; using System.Linq; using System.Web;

using System.Web.Security; using System.Web.UI;

using System.Web.UI.HtmlControls; using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts; using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) { }

protected void Button1_Click(object sender, EventArgs e)

16

{

Label1.Text = \您的个人信息如下:
\ string message = \

message += \姓名:\ message += \密码:\

message += \性别:\ message += \出生日期:\

message += \专业:\+ ddlspeciality.SelectedItem.Text + \ message += \爱好:\

for (int j = 0; j < Chkhobby.Items.Count; j++) {

if (Chkhobby.Items[j].Selected == true) {

message += \ }

}

message += \联系地址:\ message += \邮政编码:\ message += \联系电话:\

message += \简介:\ Label1.Text += message; }

protected void Button2_Click(object sender, EventArgs e) {

txtname.Text = \ txtpwd.Text = \ txtpwd1.Text = \

Rdoltsex.ClearSelection(); txtbirthday.Text = \

ddlspeciality.ClearSelection(); Chkhobby.ClearSelection(); txtaddress.Text = \ txtyb.Text = \ txttel.Text = \

txtintroduction.Text = \ Label1.Text = \ }

}

任务五:

使用FILeUpLoad控件上传图象文件到Web服务器,并将图象文件在Image控件中显示出来,同时要显示出文件上传的相关信息。

程序启动后,由于没有上传图象,所以此时Image控件显示替换文本“尚未上传图象”如图;图象文件上传成功,提示“文件上传成功”,并在Image控件中显

17

搜索更多关于: 动态网页设计实训指导书 的文档
动态网页设计实训指导书.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c803rc7wqwm0fvan2h1oh_5.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top