Change H3 Color

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5

<script>
	let h3Tags = document.getElementsByTagName("h3"); // 获取所有h3标签
	let index = 0; // 初始化索引
	let intervalId = setInterval(function() { // 设置定时器
		h3Tags[index].style.color = "red"; // 改变当前标签颜色
		if(index > 0) { // 如果不是第一个标签
			h3Tags[index - 1].style.color = ""; // 恢复上一个标签颜色
		}
		index++; // 索引加1
		if(index >= h3Tags.length) { // 如果索引大于等于标签数量
			clearInterval(intervalId); // 清除定时器
		}
	}, 1000); // 每秒执行一次
</script>

原文地址: https://www.cveoy.top/t/topic/dq0J 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录