原代码,下:
<%@ page language="vb" debug="true" %>
<script runat="server">
sub test_click(sernder as object,e as eventargs)
dim strname as string
dim stryear as string
dim strday as string
dim strmonth as string
dim strdate as date
dim i as integer
dim firstdate() as date={dateserial(2000,12,22),dateserial(2000,1,20),dateserial
(2000,2,19),dateserial(2000,3,21),dateserial(2000,4,20),dateserial(2000,5,21),dateserial
(2000,6,22),dateserial(2000,7,23),dateserial(2000,8,23),dateserial(2000,9,23),dateserial
(2000,10,24),dateserial(2000,11,23)}
dim lastdate() as date={dateserial(2001,1,19),dateserial(2000,2,18),dateserial
(2000,3,20),dateserial(2000,4,19),dateserial(2000,5,20),dateserial(2000,6,21),dateserial
(2000,7,22),dateserial(2000,8,22),dateserial(2000,9,22),dateserial(2000,10,23),dateserial
(2000,11,22),dateserial(2000,12,21)}
dim xz() as string={"魔羯座","水瓶座","双鱼座","白羊座","金牛座","双子座","巨蟹座","狮子
座","处女座","天秤座","天蝎座","射手座"}
strname=thename.text
stryear=theyear.text
strmonth=themonth.text
strday=theday.text
if strname="" or stryear="" or strmonth="" or strday="" then
thelabel.text="信息不全,无法测试星座!"
else
if (not isnumeric(stryear)) or (not isnumeric(strmonth)) or (not isnumeric(strday)) then
thelabel.text="信息错误,无法测试星座!"
else
if (ctype(strmonth,integer)<=0 or ctype(strmonth,integer)>12) or (ctype(strday,integer)<=0
or ctype(strday,integer)>31) then
thelabel.text="信息错误,无法测试星座!"
else
thedate=dateserial(2000,cint(strmonth),cint(strday))[浏览器显示这句错了,请问错在哪里?]
i=0
do while i<12
if thedate>=firstdate(i)and thedate<=lastdate(i) then
exit do
end if
i=i+l
loop
thelabel.text=strname & ", 你所属的星座是: " & xz(i)
end if
end if
end if
end if
end sub
</script>
<html>
<head>
<title>星座测试</title>
</head>
<body>
<h2 align="center" style="color:blue">星座测试<br></h2><hr>
<center>
<form runat="server">
<asp:table id="tablel" width="50%" runat="server">
<asp:tablerow height="40">
<asp:tablecell align="right">你的姓名: </asp:tablecell>
<asp:tablecell>
<asp:textbox id="thename" columns=23 runat=server />
</asp:tablecell>
</asp:tablerow>
<asp:tablerow height="40">
<asp:tablecell align="right">出生日期: </asp:tablecell>
<asp:tablecell>
<asp:textbox id="theyear" columns=6 runat=server />年
<asp:textbox id="themonth" columns=3 runat=server />月
<asp:textbox id="theday" columns=3 runat=server />日
</asp:tablecell>
</asp:tablerow>
<asp:tablerow height="40" align="center">
<asp:tablecell colspan=2>
<asp:button id="test" text="星座测试" onclick="test_click"
runat=server />
</asp:tablecell>
</asp:tablerow>
</asp:table><br><br>
<asp:label id="thelabel" font-size="14pt" forecolor="red" text=""
runat=server />
</form></center>
</body>
</html>