对象不支持属性或方法' indexOf'在IE中

时间:2012-04-26 09:35:03

标签: javascript internet-explorer three.js

  

可能重复:
  How to fix Array indexOf() in JavaScript for IE browsers

我正在使用three.js,当我将摄像机添加到场景时,它会发出警告错误

Object doesn't support property or method 'indexOf'

我的代码是

<script src="build/Three.js"></script>
<script>
        var container;
        var camera, scene, renderer, objects;
        var particleLight, pointLight,theta = 45;
        var materials,k=0;

        init();
        animate();

        function init()
        {
            container = document.createElement('div');
            document.body.appendChild(container);

            camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
            camera.position.set( 0, 200, 800 );

            scene = new THREE.Scene();
            scene.add(camera);
         }
</script>

indexOf函数在Three.js文件中使用,代码为

add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__addObject(a)}}

0 个答案:

没有答案