代码如下:
1
<script language="vb" runat="server">
2
Sub page_load()sub page_load(sender as object,e as eventargs)
3
response.cookies("mycookie").values("username")=name.text
4
response.cookies("mycookie").values("usernumber")=number.text
5
response.cookies("mycookie").values("yuan")=yuan.selecteditem.text
6
response.cookies("mycookie").values("lastvisited")=datetime.now.tolongtimestring()
7
response.cookies("mycookie").expires=datetime.now.adddays(7)
8
end sub
9
Sub button_click()sub button_click(sender as object,e as eventargs)
10
dim mycookie as HttpCookie=request.cookies("mycookie")
11
message2.text="<h2>您登陆的时间为:" & mycookie.values("lastvisited") & "</h2>"
12
if number.text mod 2=0 then
13
juan2.visible="true"
14
juan1.visible="false"
15
message1.text="<h2>您的姓名为:" & name.text & "<br>" & "您的学号为:" & number.text & "<br>" & "您是" & yuan.selecteditem.text & "的学生,您的学号为偶数,做B卷</h2>"
16
else
17
juan1.visible="true"
18
juan2.visible="false"
19
message1.text="<h2>您的姓名为:" & name.text & "<br>" & "您的学号为:" & number.text & "<br>" & "您是" & yuan.selecteditem.text & "的学生,您的学号为奇数,做A卷</h2>"
20
end if
21
end sub
22
Sub button2_click()sub button2_click(sender as object,e as eventargs)
23
dim msg as string=""
24
if radiobuttonlist.items(2).selected
25
msg=msg & "<br>" & "<h3>您做对了,恭喜您得100分</h3>"
26
else
27
msg=msg & "<br>" & "<h3>您做错了,继续努力把</h3>"
28
end if
29
if page.isvalid then
30
message.text=msg
31
end if
32
end sub
33
Sub button3_click()sub button3_click(sender as object,e as eventargs)
34
dim msg as string=""
35
if today.items(2).selected or today.items(3).selected then
36
msg=msg & "<br>" & "<h3>您做错了,继续努力把</h3>"
37
else
38
msg=msg & "<br>" & "<h3>您做对了,恭喜您得100分</h3>"
39
end if
40
if page.isvalid then
41
message0.text=msg
42
end if
43
end sub
44
Sub button1_click()sub button1_click(sender as object,e as eventargs)
45
page.response.redirect("\index.aspx")
46
end sub
47
</script>
48
<head>
49
<style type="text/css">
50
<!--
51
body {background-color: #98AB6F }
52
h1 {font: 16pt/18pt "Arial"; font-weight: bold; color: maroon}
53
h2 {font: 13pt/15pt "Arial"}
54
h3 {font: 14pt/16pt "Arial"; font-weight: bold; color:crimson}
55
-->
56
</style>
57
</head>
58
<body>
59
<form runat="server">
60
<asp:panel runat="server" id="ziliao">
61
<fieldset>
62
<legend><h1>个人资料<h1></legend>
63
姓名:
64
<asp:textbox runat="server" id="name" columns="7"/>
65
<asp:requiredfieldvalidator runat="server" controltovalidate="name" errormessage="请输入姓名"/>
66
<br>
67
学号:
68
<asp:textbox runat="server" id="number" columns="7"/>
69
<asp:regularexpressionvalidator runat="server" enableclientscript="false" controltovalidate="number" validationexpression="[0-9]{7}" errormessage="学号输入有误"/>
70
<asp:requiredfieldvalidator runat="server" controltovalidate="number" errormessage="请输入学号"/>
71
<br>
72
学院:
73
<asp:dropdownlist runat="server" id="yuan">
74
<asp:listitem>海洋学院</asp:listitem>
75
<asp:listitem>信息学院</asp:listitem>
76
<asp:listitem>人文学院</asp:listitem>
77
<asp:listitem>食品学院</asp:listitem>
78
</asp:dropdownlist>
79
</fieldset>
80
<asp:button runat="server" text="提交资料" id="button" onclick="button_click"/>
81
<asp:button runat="server" text="重新填写" id="button1" onclick="button1_click"/>
82
</asp:panel>
83
<asp:label runat="server" id="message1"/>
84
<span id=applelew>
85
86
<script>
87
Function show2()function show2(){
88
if (!document.all)
89
return
90
var Digital=new Date()
91
var hours=Digital.getHours()
92
var minutes=Digital.getMinutes()
93
var seconds=Digital.getSeconds()
94
if (minutes<=9)
95
minutes="0"+minutes
96
if (seconds<=9)
97
seconds="0"+seconds
98
var ctime=hours+":"+minutes+":"+seconds+" "
99
applelew.innerHTML="<h2 style='color:blue;'>现在的时间是:"+ctime+"</h2>"
100
setTimeout("show2()",1000)
101
}
102
window.onload=show2
103
</script>
104
</span>
105
<asp:label runat="server" id="message2"/>
106
<asp:panel runat="server" id="juan1" visible="false">
107
<fieldset>
108
<legend><h1>A卷题目:</h1></legend>
109
明末引清兵进关的是:<br>
110
<asp:radiobuttonlist runat="server" id="radiobuttonlist" repeatdirection="horizontal">
111
<asp:listitem>吴一桂</asp:listitem>
112
<asp:listitem>吴二桂</asp:listitem>
113
<asp:listitem>吴三桂</asp:listitem>
114
<asp:listitem>吴四桂</asp:listitem>
115
</asp:radiobuttonlist>
116
<br>
117
<asp:button runat="server" text="提交" id="button2" onclick="button2_click"/>
118
<br>
119
<asp:label runat="server" id="message"/>
120
</fieldset>
121
</asp:panel>
122
<asp:panel runat="server" id="juan2" visible="false">
123
<fieldset>
124
<legend><h1>B卷题目:</h1></legend>
125
中国的政治和经济中心分别是:<br>
126
<asp:checkboxlist runat="server" id="today" repeatdirection="horizontal">
127
<asp:listitem>北京</asp:listitem>
128
<asp:listitem>上海</asp:listitem>
129
<asp:listitem>西藏</asp:listitem>
130
<asp:listitem>山东</asp:listitem>
131
</asp:checkboxlist>
132
<br>
133
<asp:button runat="server" text="提交" id="button3" onclick="button3_click"/>
134
<br>
135
<asp:label runat="server" id="message0"/>
136
</fieldset>
137
</asp:panel>
138
</form>
139
</body>
140
</html>

2


3

4

5

6

7

8

9


10

11

12

13

14

15

16

17

18

19

20

21

22


23

24

25

26

27

28

29

30

31

32

33


34

35

36

37

38

39

40

41

42

43

44


45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87


88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140
