大家好,新手请求帮助!

aiyeshu 2004-05-06 04:54:34
我刚开始学习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>
...全文
160 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
aiyeshu 2004-05-06
  • 打赏
  • 举报
回复
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: System.Web.UI.WebControls.ListItemCollection must have items of type 'System.Web.UI.WebControls.ListItem'. 'br' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

Source Error:


Line 42: <asp:listitem>10</asp:listitem>
Line 43: </dropdownlist>
Line 44: <br>
Line 45: <br>
Line 46: <input type="submit" value="Submit guess">

aiyeshu 2004-05-06
  • 打赏
  • 举报
回复
不知道啊,书上是这么写的.看你回复后,我又加(runat="server"),也还是不行.
listhome 2004-05-06
  • 打赏
  • 举报
回复
错误信息?
你这是<input type="submit" value="Submit guess">也不是服务端控件呀?

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧