首 页 | 网页模板 | 教程 | 源码下载 | 书籍下载 | 图片素材 | 字体 | JAVA特效 | FLASH源码 | 软件 | 矢量 | 论坛 | 其它 |
设为主页
加入收藏
联系站长
平面设计 | 网页制作 | 程序编写 | 数 据 库 | 媒体动画 | 网络冲浪 | 服务器相关 |
当前在线
广告:P4服务器电信机房6999/年即送产权 | 疾风下载
Asp.net中对象使用的实例
2005-4-1 7:23:55  作者:模板天下收集整理  来源:未知 网友评论 0 条 论坛
  <%@ Page Language="c#" runat="server" %>
<script runat="server">

void Page_Load()
{
pi.Text = Math.PI.ToString();
exp.Text = Math.E.ToString();
}
void Update(object sender, EventArgs e)
{
try
{
double dblInput = Convert.ToDouble(input.Text);
sqrt_input.Text = dblInput.ToString();
sqrt_result.Text = Math.Sqrt(dblInput).ToString();
abs_input.Text = dblInput.ToString();
abs_result.Text = Math.Abs(dblInput).ToString();
log_input.Text = dblInput.ToString();
log_result.Text = Math.Log10(dblInput).ToString();
} catch {
sqrt_result.Text = "";
abs_result.Text = "";
log_result.Text = "";
errormessage.Text = "Error occurred in input";
}
}

</script>
<html>
<head>
</head>
<body>
<hr />
Pi = <asp:Label id="pi" runat="server"></asp:Label>
<br />
Exponential Constant = <asp:Label id="exp" runat="server"></asp:Label>
<hr />
<form runat="server">
Input =
<asp:textbox id="input" runat="server"></asp:textbox>
<asp:button id="Button1" onclick="Update" runat="server" text="Submit"></asp:button>
</form>
<hr />
Square root of <asp:Label id="sqrt_input" runat="server"></asp:Label>= <asp:Label id="sqrt_result" runat="server"></asp:Label>
<br />
Absolute Value of <asp:Label id="abs_input" runat="server"></asp:Label>= <asp:Label id="abs_result" runat="server"></asp:Label>
<br />
Logarithm of <asp:Label id="log_input" runat="server"></asp:Label>= <asp:Label id="log_result" runat="server"></asp:Label>
<br />
<asp:Label id="errormessage" runat="server"></asp:Label>
<br />
</body>
</html>
共分1页  [1] 
>> 相关文章
·Asp.net中对象使用的实例
·Asp.net中对象使用的实例

关于网站 | 客服中心 | 服务条款 | 友情链接 | 广告联系 | 本站历程 | 网站导航

吉ICP备05000107号