0

除了IE10之外,所有其他浏览器似乎在所有其他浏览器中都可以正常运行,在选择一个月/年时,它将每月随机跳过。

每次更改日期时都会引发错误,但似乎此错误并不总是会导致问题

Unable to get property 'length' of undefined or null reference

正在使用的代码片段:

var vals;

if (typeof(targetedControl.Validators) != "undefined") {
    vals = targetedControl.Validators;
}
else {
    if (targetedControl.tagName.toLowerCase() == "label") {
        targetedControl = document.getElementById(targetedControl.htmlFor);
        vals = targetedControl.Validators;
    }
}

var i;

for (i = 0; i < vals.length; i++) {
    ValidatorValidate(vals[i], null, event);
}
4

1 回答 1

-1

似乎 vals 为空/可能找不到targetedControl ...这应该让您知道:

if(!targetedControl || !vals)
{
    alert('Control Not Found!');
}
else
{
    for (i = 0; i < vals.length; i++) {
        ValidatorValidate(vals[i], null, event);
    }
}
于 2013-04-05T14:52:16.023 回答