gpt4 book ai didi

javascript - 未捕获的类型错误 : Cannot read property 'nextSibling' of undefined

转载 作者:行者123 更新时间:2023-12-05 06:37:58 25 4
gpt4 key购买 nike

<分区>

这是我在控制台中收到错误的一段代码,有人能指出我哪里做错了吗?提前致谢。

var intervalID = setInterval(function() {
// every 4 seconds execute following
var visibleWord = document.getElementsByClassName('visible')[0],
nextWord = visibleWord.nextSibling;

// check if nextSibling is textnode (whitespace) - if so get next next sibling.
if (nextWord.nodeType == 3) nextWord = nextWord.nextSibling;

// if there is a next node
if (!(nextWord == null)) {
visibleWord.setAttribute('class', 'hidden');
nextWord.setAttribute('class', 'visible');
} else {
clearInterval(intervalID);
}
}, 4000)

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com