Javascript 为什么我';“我得到了错误”;无法读取属性';类列表';在HtmlListElement处未定义的值。<;匿名>&引用;

Javascript 为什么我';“我得到了错误”;无法读取属性';类列表';在HtmlListElement处未定义的值。<;匿名>&引用;,javascript,Javascript,因此,我正在开发一个使用navdots作为用户滑动面板的图库,但出于某种原因,我的这行代码中出现了一个错误: navdots[ad.fs.currentPoint].classList.add('active'); ad.logger.track('cta_swipe', { o: 'slide' + ad.fs.currentPoint }); 这可能是什么原因造成的?另外,这里是我的navdots设置: <ul id="navdots"&g

因此,我正在开发一个使用navdots作为用户滑动面板的图库,但出于某种原因,我的这行代码中出现了一个错误:

    navdots[ad.fs.currentPoint].classList.add('active');
    ad.logger.track('cta_swipe', {
      o: 'slide' + ad.fs.currentPoint
    });
这可能是什么原因造成的?另外,这里是我的navdots设置:

    <ul id="navdots">\
      <li class="point active"></li>\
      <li class="point"></li>\
    </ul>\

你能用一个片段来回答这个问题吗?。
错误与调用classList函数的对象相关,该对象未正确定义。通常,如果从与表中任何对象都不对应的数组或索引值获取对象,则忘记指定表索引是错误的。例如,如果您有4个值,并且您要求它为5。执行代码段,以便在步骤中查看关注此细节的代码。他经常来。尽管它指出真正失败的是对象的定义。

ad.fs.currentPoint
<0或>1,或者甚至不是一个数字?-尝试
console.log(ad.fs.currentPoint);console.log(navdots[ad.fs.currentPoint])
-输出看起来正确吗?实际上是正确的。但是仍然会收到错误。它会将什么记录到控制台,看起来是0或1。这似乎是对的,因为我只有两张幻灯片。第一个是0,依此类推。另一个是控制台输出
setupSlider: function() {
      var navdots = ad.expandable.findAll('.point');
      navdots = [].slice.apply(navdots);

      var fs = new Flipsnap(ad.expandable.find('#slider'), {document: ad.expandable.el.contentDocument});
      ad.fs = fs;

      var leftArrow = ad.expandable.find('#leftArrow');
      var rightArrow = ad.expandable.find('#rightArrow');

      leftArrow.addEventListener('click', function() {
        if(fs.currentPoint === 0) {
          fs.moveToPoint(fs._maxPoint);
        }
        else {
          fs.toPrev();
        }
      });
      rightArrow.addEventListener('click', function() {
        if(fs.currentPoint === fs._maxPoint) {
          fs.moveToPoint(0);
        }
        else {
          fs.toNext();
        }
      });
       navdots.forEach(function(dot, index) {
        dot.addEventListener('click', function() {
          fs.moveToPoint(index);
        });
      });
      ad.fs.element.addEventListener('fspointmove', function() {
        navdots.forEach(function(dot) {
          dot.classList.remove('active');
        });
        navdots[ad.fs.currentPoint].classList.add('active');
        ad.logger.track('cta_swipe', {
          o: 'slide' + ad.fs.currentPoint
        });
      });
    },