是否有另一种方法可以将 onTextChanged 用于 TextBox 并避免每次都刷新页面?

Is there another way to use onTextChanged for TextBox and avoid page refreshing every time?

我有一个 JavaScript 正在从文本字段进行一些计算,每次我传递其他文本字段时 JavaScript 都会在 TextBox 'onTextChanged' 中调用操作,这需要 AutoPostBack =是的,但每次刷新我的页面时,因为我每次都需要在 TextBox 上单击两次。

我已经尝试将这行代码放在 PageLoad 上,但它仍然需要 'AutoPostBack = True' 并且它还刷新页面 :

 CType(Me.FV.FindControl("txtLP_1"), TextBox).Attributes.Add("onblur", "javascript:startCalc();")

这是 PageLoad 上的代码:

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

    If Not IsPostBack Then

    End If

    CType(Me.FV.FindControl("txtLP_1"), TextBox).Attributes.Add("onblur", "javascript:startCalc();")

End Sub

与其设置 AutoPostBack="True" 并在每次 TextBox 控件中的值发生变化时调用 post,不如直接通过 [=15= 处理文本更改事件](完全客户端)?

<head runat="server">
    <title></title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#' + '<%: TextBox1.ClientID %>').on('input', function (e) {
                var value = $(this).val();
                alert(value);
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    </form>
</body>