我只是想让 Visual Basic 读取文本框并将值设置为变量,但它似乎不起作用。有任何想法吗?
HTML:
<body>
<script>
function myfn() {
alert(<%= myInputAge%>)
}
</script>
<form id="form1" runat="server">
<div>
<asp:TextBox id="av10test" runat="server" Text="hello"></asp:TextBox>
</div>
<div>
<input type="button" onclick=myfn() value="hello"/>
</div>
</form>
</body>
代码背后:
Partial Class WebForm7
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
myInputAge = av10test.Text
End If
End Sub
Protected Property myInputAge
End Class