简体   繁体   English

ASP.NET Javascript 运行时错误

[英]ASP.NET Javascript runtime error

I have just started a new ASP.NET web application and I am totally new to everything and after moving a few things round I have been getting this error and I don't understand what it means.我刚刚开始了一个新的 ASP.NET Web 应用程序,我对一切都是全新的,在移动了一些东西之后,我收到了这个错误,我不明白它的意思。

It happens when I go to enter anything in the Password box.当我在密码框中输入任何内容时会发生这种情况。

在此处输入图片说明

Could someone please help me out on this issue.有人可以帮我解决这个问题。

EDIT:编辑:

    <li>
        <asp:Label runat="server" AssociatedControlID="Password">Password</asp:Label>
        <asp:TextBox runat="server" ID="Password" TextMode="Password" onkeypress="capLock(event)" />
        <asp:RequiredFieldValidator runat="server" ControlToValidate="Password" CssClass="field-validation-error" ErrorMessage="The password field is required." />
    </li>

document.getElementById("divMayus") is returning null or undefined. document.getElementById("divMayus")返回 null 或未定义。

You should look at the rendered html and find the div that you are trying to reference to make sure the id is the same as you are trying to reach.您应该查看呈现的 html 并找到您尝试引用的 div,以确保 id 与您尝试访问的 id 相同。 Asp.net alters the ids of server controls depending on their containers. Asp.net 根据其容器更改服务器控件的 ID。 So if you moved stuff around, the id may have also been changed.因此,如果您四处移动东西,则 id 也可能已更改。

Try to do that inside试着在里面做

window.onload = function(){
  // code goes here
}

I think you are trying to access DOM even before it is being created.我认为您甚至在创建 DOM 之前就尝试访问它。

the document.getElementById('divMayus') is undefined document.getElementById('divMayus') undefined

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 数据表行重新排序期间的JavaScript运行时错误(ASP.Net MVC) - JavaScript runtime error during DataTables rowReordering (ASP.Net MVC) 如何修复Asp.net运行时错误 - How to fix asp.net runtime error ASP.NET和Javascript错误 - ASP.NET and Javascript Error IE 10引发“ 0x800a1391-JavaScript运行时错误:&#39;jQuery&#39;未定义”(ASP.NET) - IE 10 Throws “0x800a1391 - JavaScript runtime error: 'jQuery' is undefined” (ASP.NET) asp.net MVC 4 0x80070005 - Javascript运行时错误:访问被拒绝 - asp.net MVC 4 0x80070005 - Javascript runtime error: access denied 将JavaScript放在单独的JS文件中后,ASP.net MVC 3中的JScript运行时错误 - JScript Runtime Error in ASP.net MVC 3 after placing the javascript in a separate JS File 异常0x800a1391-JavaScript运行时错误:在ASP.NET MVC中未定义&#39;JSON&#39; - Exception 0x800a1391 - JavaScript runtime error: 'JSON' is undefined in asp.net mvc 在运行时为 ASP.NET 核心缩小动态生成的 JavaScript - Minify dynamically generated JavaScript at runtime for ASP.NET Core asp.net javascript ajax错误:找不到 - asp.net javascript ajax error: not found ASP.NET运行时错误:无法加载文件或程序集&#39;DotNetOpenAuth, - ASP.NET runtime error: Could not load file or assembly 'DotNetOpenAuth,
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM