我正在尝试使用 ASP(代码取自 W3 Schools)显示一个文本框,但是当我使用本地 IIS 服务器运行网站时,我只看到“输入您的姓名:”标签。
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
lbl1.Text="Your name is " & txt1.Text
End Sub
</script>
<!DOCTYPE html>
<html>
<body>
<form runat="server">
Enter your name:
<asp:TextBox id="txt1" runat="server" />
<asp:Button OnClick="submit" Text="Submit" runat="server" />
<p><asp:Label id="lbl1" runat="server" /></p>
</form>
</body>
</html>
注意:这是一个坚持使用 ASP 的人的项目,所以我不会做 PHP,我不知道 ASP。
谢谢。
编辑这是呈现的 HTML
<html><head><script runat="server">
Sub submit(sender As Object, e As EventArgs)
lbl1.Text="Your name is " & txt1.Text
End Sub
</script>
</head><body>
<form runat="server">
Enter your name:
<asp:textbox id="txt1" runat="server">
<asp:button onclick="submit" text="Submit" runat="server">
<p><asp:label id="lbl1" runat="server"></asp:label></p>
</asp:button></asp:textbox></form></body></html>