制作网页计算器网站脚本技术ASP NET课程设计Word文档下载推荐.docx
- 文档编号:18987812
- 上传时间:2023-01-02
- 格式:DOCX
- 页数:20
- 大小:214.68KB
制作网页计算器网站脚本技术ASP NET课程设计Word文档下载推荐.docx
《制作网页计算器网站脚本技术ASP NET课程设计Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《制作网页计算器网站脚本技术ASP NET课程设计Word文档下载推荐.docx(20页珍藏版)》请在冰豆网上搜索。
2)<
scriptrunat="
server"
>
3)Subpage_load()'
页面加载
4)IfNot(Page.IsPostBack)Then'
首次加载页面,给输出屏幕赋值
5)shuchu.Text="
0"
6)jz16.Text="
7)jz8.Text="
8)jz2.Text="
9)jc.Text="
"
10)zt.Text="
11)EndIf
12)jc2.Text="
13)EndSub
14)
15)PublicFunctionjinzhi()'
进制转换函数
16)jc2.Text=Val(shuchu.Text)'
16进制转换
17)jz16.Text="
18)DoWhileVal(jc2.Text)>
0
19)SelectCaseCStr(Val(jc2.Text)Mod16)
20)Case"
10"
21)jz16.Text="
A"
&
jz16.Text
22)Case"
11"
23)jz16.Text="
B"
24)Case"
12"
25)jz16.Text="
C"
26)Case"
13"
27)jz16.Text="
D"
28)Case"
14"
29)jz16.Text="
E"
30)Case"
15"
31)jz16.Text="
F"
32)CaseElse
33)jz16.Text=Val(jc2.TextMod16)&
34)EndSelect
35)jc2.Text=Str(Val(jc2.Text)\16)
36)Loop
37)
38)jc2.Text=Val(shuchu.Text)'
8进制转换
39)jz8.Text="
40)DoWhileVal(jc2.Text)>
41)jz8.Text=(Val(jc2.Text)Mod8)&
jz8.Text
42)jc2.Text=Str(Val(jc2.Text)\8)
43)Loop
44)
45)jc2.Text=Val(shuchu.Text)'
2进制转换
46)jz2.Text="
47)DoWhileVal(jc2.Text)>
48)jz2.Text=(Val(jc2.Text)Mod2)&
jz2.Text
49)jc2.Text=Str(Val(jc2.Text)\2)
50)Loop
51)jc2.Text="
52)
53)Ifshuchu.Text=0Then'
如果当前值为“0”
54)jz16.Text=0
55)jz8.Text=0
56)jz2.Text=0
57)EndIf
58)EndFunction
59)
60)ProtectedSubzero_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单击“0”按钮时
61)Ifshuchu.Text<
"
Then'
如果当前输出为非“0”,则在字符串右边加上“0”
62)shuchu.Text=shuchu.Text&
63)ElseIfshuchu.Text="
如果当前输出为“0”,则不在字符串右边加“0”
64)shuchu.Text=0
65)EndIf
66)jinzhi()'
调用进制转换函数
67)EndSub
68)
69)ProtectedSubone_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单机“1”按钮时
70)Ifshuchu.Text<
如果当前输出为非“0”,则在字符串右边加上“1”
71)shuchu.Text=shuchu.Text&
1
72)EndIf
73)Ifshuchu.Text="
如果当前输出为“0”,则直接赋值输出“1”
74)shuchu.Text=1
75)EndIf
76)jinzhi()'
77)EndSub
78)
79)ProtectedSubtwo_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
同上……
80)Ifshuchu.Text<
Then
81)shuchu.Text=shuchu.Text&
2
82)EndIf
83)Ifshuchu.Text="
84)shuchu.Text=2
85)EndIf
86)jinzhi()
87)EndSub
88)
89)ProtectedSubthree_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
90)Ifshuchu.Text<
91)shuchu.Text=shuchu.Text&
3
92)EndIf
93)Ifshuchu.Text="
94)shuchu.Text=3
95)EndIf
96)jinzhi()
97)EndSub
98)
99)ProtectedSubfour_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
100)Ifshuchu.Text<
101)shuchu.Text=shuchu.Text&
4
102)EndIf
103)Ifshuchu.Text="
104)shuchu.Text=4
105)EndIf
106)jinzhi()
107)EndSub
108)
109)ProtectedSubfive_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
110)Ifshuchu.Text<
111)shuchu.Text=shuchu.Text&
5
112)EndIf
113)Ifshuchu.Text="
114)shuchu.Text=5
115)EndIf
116)jinzhi()
117)EndSub
118)
119)ProtectedSubsix_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
120)Ifshuchu.Text<
121)shuchu.Text=shuchu.Text&
6
122)EndIf
123)Ifshuchu.Text="
124)shuchu.Text=6
125)EndIf
126)jinzhi()
127)EndSub
128)
129)ProtectedSubseven_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
130)Ifshuchu.Text<
131)shuchu.Text=shuchu.Text&
7
132)EndIf
133)Ifshuchu.Text="
134)shuchu.Text=7
135)EndIf
136)jinzhi()
137)EndSub
138)
139)ProtectedSubeight_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
140)Ifshuchu.Text<
141)shuchu.Text=shuchu.Text&
8
142)EndIf
143)Ifshuchu.Text="
144)shuchu.Text=8
145)EndIf
146)jinzhi()
147)EndSub
148)
149)ProtectedSubnine_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
150)Ifshuchu.Text<
151)shuchu.Text=shuchu.Text&
9
152)EndIf
153)Ifshuchu.Text="
154)shuchu.Text=9
155)EndIf
156)jinzhi()
157)EndSub
158)
159)ProtectedSubdot_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单击“.”按钮时
160)IfVal(shuchu.Text)Mod1<
0Then'
如果当前屏幕输出数值为小数,则不修改任何属性
161)EndIf
162)IfVal(shuchu.Text)Mod1=0Then'
如果当前屏幕输出数值为整数,则在字符串的右边加上“.”
163)shuchu.Text=shuchu.Text&
."
164)EndIf
165)jinzhi()
166)EndSub
167)
168)ProtectedSubclean_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单击“C”按钮时
169)shuchu.Text=0'
主屏幕输出数值归零
170)jc.Text="
'
清除寄存数值
171)zt.Text="
清除当前计算状态
172)jz16.Text=0
173)jz8.Text=0
174)jz2.Text=0
175)EndSub
176)
177)ProtectedSubeq_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单击“=”按钮时
178)SelectCase(zt.Text)
179)Case"
+"
当前计算状态为"
加法"
,把当前主屏幕数值和寄存器内数值“相加”,并由主屏幕输出
180)shuchu.Text=Str(Val(jc.Text)+Val(shuchu.Text))
181)Case"
-"
当前计算状态为“减法”,把当前主屏幕数值和寄存器内数值“相减”,并由主屏幕输出
182)shuchu.Text=Str(Val(jc.Text)-Val(shuchu.Text))
183)Case"
×
当前计算状态为“乘法”,把当前主屏幕数值和寄存器内数值“相乘”,并由主屏幕输出
184)shuchu.Text=Str(Val(jc.Text)*Val(shuchu.Text))
185)Case"
÷
当前计算状态为“除法”,把当前主屏幕数值和寄存器内数值“相除”,并由主屏幕输出
186)shuchu.Text=Str(Val(jc.Text)/Val(shuchu.Text))
187)Case"
%"
当前计算状态为“求余”,把当前主屏幕数值和寄存器内数值“求余”,并由主屏幕输出
188)shuchu.Text=Str(Val(jc.Text)ModVal(shuchu.Text))
189)Case"
x^y"
当前计算状态为“X分之一”,把当前主屏幕数值和寄存器内数值“X分之一”,并由主屏幕输出
190)shuchu.Text=Str(Val(jc.Text)^Val(shuchu.Text))
191)EndSelect
192)shuchu.Text=Val(shuchu.Text)
193)jinzhi()
194)EndSub
195)
196)ProtectedSubsubtract_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
当单击“-”按钮时
197)jc.Text=Val(shuchu.Text)'
把当前主数值存入寄存器
198)zt.Text="
更改状态为“-”
199)shuchu.Text=0'
主屏幕清零
200)jinzhi()
201)EndSub
202)
203)ProtectedSubplus_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
同上
204)jc.Text=Val(shuchu.Text)
205)zt.Text="
206)shuchu.Text=0
207)jinzhi()
208)EndSub
209)
210)ProtectedSubmultiply_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
211)jc.Text=Val(shuchu.Text)
212)zt.Text="
213)shuchu.Text=0
214)jinzhi()
215)EndSub
216)
217)ProtectedSubdivide_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
218)jc.Text=Val(shuchu.Text)
219)zt.Text="
220)shuchu.Text=0
221)jinzhi()
222)EndSub
223)
224)ProtectedSubqiuyu_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
225)jc.Text=Val(shuchu.Text)
226)zt.Text="
227)shuchu.Text=0
228)jinzhi()
229)EndSub
230)
231)ProtectedSubxy_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
232)jc.Text=Val(shuchu.Text)
233)zt.Text="
234)shuchu.Text=0
235)jinzhi()
236)EndSub
237)
238)ProtectedSubpai_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单击“π”按钮时
239)shuchu.Text=3.1415926'
给主屏幕数值赋值并输出
240)jinzhi()
241)EndSub
242)
243)ProtectedSubx2_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单击“x^2”按钮时
244)jc.Text=Val(shuchu.Text)'
主数值放入寄存器
245)zt.Text="
x^2"
更改计算状态为“x^2”
246)shuchu.Text=Str(Val(jc.Text)^2)'
计算“x^2”
247)jinzhi()
248)EndSub
249)
250)ProtectedSubx3_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
251)jc.Text=Val(shuchu.Text)
252)zt.Text="
x^3"
253)shuchu.Text=Str(Val(jc.Text)^3)
254)jinzhi()
255)EndSub
256)
257)ProtectedSubx1_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单击“1/x”按钮时
258)jc.Text=Val(shuchu.Text)'
259)zt.Text="
1/x"
更改计算状态为“1/x”
260)shuchu.Text=Str(1/Val(jc.Text))'
计算“1/x”
261)shuchu.Text=Val(shuchu.Text)
262)jinzhi()
263)EndSub
264)
265)ProtectedSubbackspace_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)'
单击“←”按钮时
266)IfVal(shuchu.Text)/1.1<
若当前主屏幕输出数值不为个位数,则减去最右边的一位
267)shuchu.Text=Left(shuchu.Text,Len(shuchu.Text)-1)
268)EndIf
269)IfVal(shuchu.Text)/1.1=0Then'
若当前主屏幕输出数值为个位数,则清零主屏幕输出数值
270)shuchu.Text=0
271)EndIf
272)jinzhi()
273)EndSub
274)
275)<
/script>
网页代码(无注释):
htmlxmlns="
http:
//www.w3.org/1999/xhtml"
head>
3)<
title>
JVTCNET0856HP2011/12/07Shadow<
/title>
4)<
styletype="
text/css"
5)table#js{
6)margin:
0px;
7)padding:
8)background-color:
#aaaaaa;
9)}
10)td{
11)padding:
3px;
12)}
13).button{
14)width:
70px;
15)height:
50px;
16)font-size:
32px;
17)color:
#eeeeee;
18)background-color:
#111111;
19)}
20)<
/style>
21)<
/head>
22)<
bodystyle="
text-align:
center;
background-color:
#333333;
margin-top:
font-family:
Arial;
23)<
formid="
Form1"
action="
#"
runat="
24)<
tableid="
js"
25)<
tr>
26)<
tdcolspan="
5"
27)<
tablestyle="
height:
110px;
Width:
100%;
#222222;
28)<
29)<
2"
<
asp:
LabelID="
jc"
style="
overflow:
hidden;
Height="
19px"
Font-Size="
18px"
ForeColor="
#00ff00"
/>
/td>
30)<
tdcolsp
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 制作网页计算器网站脚本技术ASP NET课程设计 制作 网页 计算器 网站 脚本 技术 ASP NET 课程设计
![提示](https://static.bdocx.com/images/bang_tan.gif)