简体   繁体   English

JavaScript无效参数

[英]JavaScript Invalid Argument

I have a complex function that loops through the elements during the onSuccess: of my js and I'm getting the following error that I haven't seen before. 我有一个复杂的函数,在我的js的onSuccess:期间循环遍历元素,并且遇到了以下我从未见过的错误。

exception encountered : {"message": "Invalid argument.", "description": "Invalid argument.", "number": -2147024809, "name": "Error"}

The js function looks like this: js函数如下所示:

if(Object.isArray(list)){
     list.each(function(listItem, index){
         if(!Object.isUndefined(listItem.disabled)){
              listItem.disabled = disableFlag;
         }
     });
}

that is called from the onSuccess: portion of an Update. 从更新的onSuccess:部分调用。 My html is a button that is calling the noted function from an onclick. 我的html是一个按钮,可以通过onclick调用所提到的函数。 When I run it the onException: always happens and I'm getting the error by: 当我运行它时,onException:总是发生,并且通过以下方式得到错误:

Object.toJSON(exception)

Has anyone seen this before? 谁看过这个吗? I have tried playing around with the functionality and it seems that when I use the button to do what it's supposed to do after a specific sequence of events is the only time this happens. 我已经尝试过使用该功能,并且似乎只有当我使用按钮执行在特定事件序列之后应该执行的操作时,才会发生这种情况。 So, I placed an arbitrary link on the page and wanted to see if I clicked that, what would happen and it updated the JSON object on the page and allowed for me to use the button for it's set action without the error. 因此,我在页面上放置了一个任意链接,想要查看是否单击了该链接,会发生什么,它更新了页面上的JSON对象,并允许我使用该按钮进行设置操作而没有错误。 Any help would be appreciated. 任何帮助,将不胜感激。

Most of the time this kind of error happens in IE when you set an attribute of a DOM element. 在大多数情况下,当您设置DOM元素的属性时,IE中都会发生这种错误。

If listItem is DOM element then maybe it's not yet added to the document or disableFlag is an invalid value. 如果listItem是DOM元素,则可能尚未将其添加到文档中,或者disableFlag是无效值。 Or the error happens outside the provided code. 或者错误发生在提供的代码之外。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM