大家好,新手请求帮助!
我刚开始学习ASP。NET,照书做实验,可总是不行。检查了好多遍,请大家帮我看看,谢谢!
==========================================
<script language="vb" runat="server">
Sub Page_Load()
Dim theNumber As Integer
Dim theGuess As Integer
theNumber=int(10*rnd)+1
If Request.Form("Guess")<>"" Then
theGuess=Request.Form("Guess")
If theGuess>theNumber then
Message.Text="<BR><BR>Guess is too high<BR>Try again-It was"_& theNumber
End If
If theGuess<theNumber then
Message.Text="<BR><BR>Guess is too low<BR>Try again-It was"_& theNumber
End If
If theGuess=theNumber then
Message.Text="<BR><BR>Guess is correct!"
End If
End If
End Sub
</script>
<html>
<head>
<title>If Then</tilte>
</head>
<body>
<form runat="server">
What number am I thinking of?
<asp:dropdownlist id="Guess" runat="server">
<asp:listitem>1</asp:listitem>
<asp:listitem>2</asp:listitem>
<asp:listitem>3</asp:listitem>
<asp:listitem>4</asp:listitem>
<asp:listitem>5</asp:listitem>
<asp:listitem>6</asp:listitem>
<asp:listitem>7</asp:listitem>
<asp:listitem>8</asp:listitem>
<asp:listitem>9</asp:listitem>
<asp:listitem>10</asp:listitem>
</dropdownlist>
<br>
<br>
<input type="submit" value="Submit guess">
<asp:label id="Message" runat="server"/>
</form>
</body>
</html>