Change H3 Color

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5

<script>
	var headings = document.getElementsByTagName('h3');
	var currentIndex = 0;

	function changeColor() {
		headings[currentIndex].style.color = 'red';
		if (currentIndex > 0) {
			headings[currentIndex - 1].style.color = '';
		} else {
			headings[headings.length - 1].style.color = '';
		}
		currentIndex = (currentIndex + 1) % headings.length;
		setTimeout(changeColor, 1000);
	}

	changeColor();
</script>

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

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