求asp简单计算器的全部代码,可对两个数做加减乘除运算,要能直接在网页运行的! 自己编的不能实现功能。。 5
<scriptLanguage="VB"runnat="sever">SubPage_load(SenderAsObject,EAsEventArgs)message.T...
<script Language ="VB"runnat="sever">
Sub Page_load(Sender As Object,E As EventArgs)
message.Text="简单计算器"
End Sub
Sub Enter_Click(Sender As Object,E As EventArgs)
Dim Text3 As String
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "请先输入数字!"
Exit Sub
End If
If b1.checked="True" Then
Text3.Text = Str(CSng(Val(Text1.Text)) + CSng(Val(Text2.Text)))
End If
If b2.checked="True" Then
Text3.Text = Str(CSng(Val(Text1.Text)) - CSng(Val(Text2.Text)))
End If
If b3.checked="True" Then
Text3.Text = Str(CSng(Val(Text1.Text)) * CSng(Val(Text2.Text)))
End If
If b4.checked="True" Then
If Val(Text2.Text) = 0 Then
MsgBox "零不能做除数!"
Exit Sub
End If
Text3.Text = Str(CSng(Val(Text1.Text)) / CSng(Val(Text2.Text)))
End If
message.innerhtml=Text3
End Sub
</Script>
<html>
<body>
<asp:label id="Message" runat=server/>
<form runnat="sever">
数据1:<input id="Text1"type="text"runat"sever"/><br>
数据2:<input id="Text2"type="text"runat"sever"/><br>
计算符号:<input id="b1"type="radio"value="+"runat="sever"/>
<input id="b2"type="radio"value="-"runat="sever"/>
<input id="b3"type="radio"value="*"runat="sever"/>
<input id="b4"type="radio"value="/"runat="sever"/><br>
<input type="submit"value="确定"onSeverClick="Enter_Click"runnat="server"/>
<input type="reset"value="重置"runnat="server"/>
</form>
</body>
</html> 展开
Sub Page_load(Sender As Object,E As EventArgs)
message.Text="简单计算器"
End Sub
Sub Enter_Click(Sender As Object,E As EventArgs)
Dim Text3 As String
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "请先输入数字!"
Exit Sub
End If
If b1.checked="True" Then
Text3.Text = Str(CSng(Val(Text1.Text)) + CSng(Val(Text2.Text)))
End If
If b2.checked="True" Then
Text3.Text = Str(CSng(Val(Text1.Text)) - CSng(Val(Text2.Text)))
End If
If b3.checked="True" Then
Text3.Text = Str(CSng(Val(Text1.Text)) * CSng(Val(Text2.Text)))
End If
If b4.checked="True" Then
If Val(Text2.Text) = 0 Then
MsgBox "零不能做除数!"
Exit Sub
End If
Text3.Text = Str(CSng(Val(Text1.Text)) / CSng(Val(Text2.Text)))
End If
message.innerhtml=Text3
End Sub
</Script>
<html>
<body>
<asp:label id="Message" runat=server/>
<form runnat="sever">
数据1:<input id="Text1"type="text"runat"sever"/><br>
数据2:<input id="Text2"type="text"runat"sever"/><br>
计算符号:<input id="b1"type="radio"value="+"runat="sever"/>
<input id="b2"type="radio"value="-"runat="sever"/>
<input id="b3"type="radio"value="*"runat="sever"/>
<input id="b4"type="radio"value="/"runat="sever"/><br>
<input type="submit"value="确定"onSeverClick="Enter_Click"runnat="server"/>
<input type="reset"value="重置"runnat="server"/>
</form>
</body>
</html> 展开
1个回答
展开全部
给个相X的给你。依此类推吧
<body onload="jisuan()"><!----------BODY中插入 让他一导入网页就开始执行JS---------->
<SCRIPT type=text/javascript>function jisuan(){
document.getElementById("hj").value =(document.getElementById("2rfj").value)*(document.getElementById("2rcw").value);;}</SCRIPT>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr style="font-family:微软雅黑; font-size:16px; text-align:center;">
<td width="12%" height="40" style="background-color:#ccc">房间类型</td>
<td width="22%" style="background-color:#ccc">房间数(间)</td>
<td width="22%" style="background-color:#ccc">床数(张/间)</td>
<td style="background-color:#ccc">酒店共可入住(人) </td>
</tr>
<tr style="font-family:微软雅黑; font-size:16px; text-align:center; color:#333;">
<td height="30" style="background-color:#ebebeb"></td>
<td style="background-color:#ebebeb;font-size:12px; ">含单双间及套间</td>
<td style="background-color:#ebebeb;font-size:12px; ">按每间二人入住</td>
<td rowspan="2" style="background-color:#ebebeb;font-size:12px; "><input type="text" value="" id="hj" style="background-color:#ebebeb; text-align:center; font-size:16px;border:0px 0px 0px 0px;" />
</td>
</tr>
<tr style="font-family:微软雅黑; font-size:16px; text-align:center; color:#333;">
<td height="30" style="background-color:#e1e1e1">全部类型</td>
<td style="background-color:#e1e1e1"><input type="text" value="{$KS_2r_fj}" id="2rfj" style=" background-color:#e1e1e1; text-align:center; font-size:16px;border:0px 0px 0px 0px;" /></td>
<td style="background-color:#e1e1e1"><input type="text" value="2" id="2rcw" style=" background-color:#e1e1e1; text-align:center; font-size:16px;border:0px 0px 0px 0px;" /></td>
</tr>
</table>
<body onload="jisuan()"><!----------BODY中插入 让他一导入网页就开始执行JS---------->
<SCRIPT type=text/javascript>function jisuan(){
document.getElementById("hj").value =(document.getElementById("2rfj").value)*(document.getElementById("2rcw").value);;}</SCRIPT>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr style="font-family:微软雅黑; font-size:16px; text-align:center;">
<td width="12%" height="40" style="background-color:#ccc">房间类型</td>
<td width="22%" style="background-color:#ccc">房间数(间)</td>
<td width="22%" style="background-color:#ccc">床数(张/间)</td>
<td style="background-color:#ccc">酒店共可入住(人) </td>
</tr>
<tr style="font-family:微软雅黑; font-size:16px; text-align:center; color:#333;">
<td height="30" style="background-color:#ebebeb"></td>
<td style="background-color:#ebebeb;font-size:12px; ">含单双间及套间</td>
<td style="background-color:#ebebeb;font-size:12px; ">按每间二人入住</td>
<td rowspan="2" style="background-color:#ebebeb;font-size:12px; "><input type="text" value="" id="hj" style="background-color:#ebebeb; text-align:center; font-size:16px;border:0px 0px 0px 0px;" />
</td>
</tr>
<tr style="font-family:微软雅黑; font-size:16px; text-align:center; color:#333;">
<td height="30" style="background-color:#e1e1e1">全部类型</td>
<td style="background-color:#e1e1e1"><input type="text" value="{$KS_2r_fj}" id="2rfj" style=" background-color:#e1e1e1; text-align:center; font-size:16px;border:0px 0px 0px 0px;" /></td>
<td style="background-color:#e1e1e1"><input type="text" value="2" id="2rcw" style=" background-color:#e1e1e1; text-align:center; font-size:16px;border:0px 0px 0px 0px;" /></td>
</tr>
</table>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询