欢迎光临
我们一直在努力

Asp.net中对象使用的实例-.NET教程,Asp.Net开发

建站超值云服务器,限时71元/月

<%@ 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>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Asp.net中对象使用的实例-.NET教程,Asp.Net开发
分享到: 更多 (0)