Firefox的错误 - 的document.all是不确定的(WebUIValidation.js)不确定、错误、document、Firefox

2023-09-06 19:38:12 作者:清风饮露

我创建了一个简单的ASP.Net应用程序,其中第一个页面接受一个输入,按一下按钮将用户重定向到下一个页面。 这是工作中的所有其他浏览器(IE,歌剧,Safari浏览器),但什么也没发生在Firefox。没有按钮点击生成的事件并没有回发发生。

I have created a simple ASP.Net application, where first page accepts an input and button click redirects the user to next page. This is working in all the other browsers (IE, Opera, Safari), but nothing is happening in Firefox. There is no event generated on button click and no postback is happening.

一看到Firefox的错误控制台给我这个错误:

A look into Firefox's error console showed me this error:

的document.all是不确定的    HTTP://xxx/aspnet_client/system_web/2_0_50727/WebUIValidation.js   行:30   行:85

document.all is undefined http://xxx/aspnet_client/system_web/2_0_50727/WebUIValidation.js Line: 30 Line: 85

在这里这个错误是WebUIValidation.js遇到的功能是:

The functions where this error is encountered in WebUIValidation.js are:

function ValidatorHookupControlID(controlID, val) {
    if (typeof(controlID) != "string") {
        return;
    }
    var ctrl = document.all[controlID];

...

function ValidatorGetValue(id) {
    var control;
    control = document.all[id];

...

请帮助!

推荐答案

尝试添加到您的web.config < xhtmlConformance模式=遗产/> 和读这个博客帖子有关其他信息如何/时,客户端验证器被添加到页面。

Try adding this to your web.config <xhtmlConformance mode="Legacy"/> and reading this blog post for additional information on how/when client side validators are added to the page.