web作业-标题每隔10秒变化颜色
p id=“demo1”>I</p
p id=“demo2”>love</p
p id=“demo3”>you</p
function myfilm(){
setTimeout(function(){document.getElementById(‘demo1’).style.color=‘red’},1000);
setTimeout(function(){document.getElementById(‘demo2’).style.color=‘red’},2000);
setTimeout(function(){document.getElementById(‘demo3’).style.color=‘red’},3000);
setTimeout(function(){document.getElementById(‘demo1’).style.color=‘black’},4000);
setTimeout(function(){document.getElementById(‘demo2’).style.color=‘black’},5000);
setTimeout(function(){document.getElementById(‘demo3’).style.color=‘black’},6000);
}
input type=“button” value=“changecolor” “myfilm()” width=“30”/>