<h1>hellow,word</h1>
<button id="k">开始</button>
<button id="t">停止</button>
<script src='https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js'></script>
<script>
let sz = 0
$('#k').click(function () {
cc = setInterval(han, 1000)
function han() {
sz++
if (sz % 2 == 0) {
$('h1').css('color', 'red')
} else {
$('h1').css('color', 'yellow')
}
}
})
$('#t').click(function () {
clearInterval(cc)
})