Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
对象中的Javascript对象错误_Javascript_Object_Internet Explorer 8_Internet Explorer 7 - Fatal编程技术网

对象中的Javascript对象错误

对象中的Javascript对象错误,javascript,object,internet-explorer-8,internet-explorer-7,Javascript,Object,Internet Explorer 8,Internet Explorer 7,当我使用javascript对象时,internet explorer 7和8中有一个奇怪的错误。它在IE9和所有其他应用程序中工作 当我使用一个对象,并且对象中的任何参数都是“class”internet explorer 7和8时,请停止执行任何操作 我使用的是jQuery1.8.2 我会给你看一些代码 var obj = { data:{class:'image',action:'getAllFkId',type:nbType, fkid:id},

当我使用javascript对象时,internet explorer 7和8中有一个奇怪的错误。它在IE9和所有其他应用程序中工作

当我使用一个对象,并且对象中的任何参数都是“class”internet explorer 7和8时,请停止执行任何操作

我使用的是jQuery1.8.2

我会给你看一些代码

var obj = {
             data:{class:'image',action:'getAllFkId',type:nbType, fkid:id},
             success:function(json){
                alert('hi');

            }
        };
        this.ajax(obj);
“this.ajax”的代码(“this”是一个对象):

如果我将参数的名称更改为任何其他名称,它将起作用

// This is just fine foo instead of class
var obj = {
         data:{foo:'image',action:'getAllFkId',type:nbType, fkid:id},
         success:function(json){
            alert('hi');

        }
    };
    this.ajax(obj);
我想了解为什么IE7-8不能使用“类”作为参数。
谢谢您的时间。

为了使用一些较旧的浏览器,您需要将
用引号括起来

data:{"class":"image",...

虽然ECMAScript允许保留字作为属性标识符,但一些较旧的浏览器不允许保留字。

非常感谢您的回答。我不知道
class
是旧浏览器的属性。
data:{"class":"image",...