js 设置服务端按钮控件(ASP.NET)不可用

js 设置服务端按钮控件(ASP.NET)不可用
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="DemoWebForm.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        window.onload = function () {
            // 设置按钮不可用
            document.getElementById('<%=btnLogin.ClientID %>').disabled = true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:button runat="server" ID="btnLogin" text="登录" />
        </div>
    </form>
</body>
</html>


作者最新文章
C# 使用 CSVHelper 操作 csv 文件, .net core, .net framework 读取写入 csv 文件
C# 实现字符串文本换行的方法,文本如何换行
C# 如何循环读取文件每一行文本内容
C# DateTime AddMonths 的错误用法导致跳过日期
C# 全角转换半角,半角转换为全角