我的问题很简单,如果DOM不会有一个文本框的值,其用户类型怎样的JavaScript检测浏览器用户键入的最新文本检测在文本框中的文本,即使pagesource显示文本框前值
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function showalert() {
var x = document.getElementById('<%=txtbx.ClientID %>').value;
alert(x);
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtbx" runat="server" Text=""></asp:TextBox>
<input type="submit" onclick="return showalert();" value="OK" />
</div>
</form>
</body>
</html>
以上是我的代码。 页面源不显示用户在文本框中键入的最新文本。 该代码在所有浏览器和所有VS版本中的工作方式类似。 我甚至跑一个普通的HTML页面的代码,而一个Visual Studio
我发布了答案尝试, – 2014-09-25 08:46:50