请参阅下面的代码...它会在页面加载+ 8秒后更改图像,然后每1秒更改一次.
setInterval(function(){
setTimeout(function(){
$('#person1').attr('src', 'lastwavewinnerimages/wtrhwt.jpg');
setTimeout(function(){
$('#person1').attr('src', 'lastwavewinnerimages/t8yejty.jpg');
setTimeout(function(){
$('#person1').attr('src', 'lastwavewinnerimages/t2tgw8.jpg');
setTimeout(function(){
$('#person1').attr('src', 'lastwavewinnerimages/45234.jpg');
setTimeout(function(){
$('#person1').attr('src', 'lastwavewinnerimages/14134.jpg');
setTimeout(function(){
$('#person1').attr('src', 'lastwavewinnerimages/124t234grq.jpg');
setTimeout(function(){
$('#person1').attr('src', 'lastwavewinnerimages/frbvqw34.jpg');
setTimeout(function(){
$('#person1').attr('src', 'lastwavewinnerimages/14tqwrbfws.jpg');
}, 1000);
}, 1000);
}, 1000);
}, 1000);
}, 1000);
}, 1000);
}, 1000);
}, 1000);
}, 8000);
Run Code Online (Sandbox Code Playgroud)
该循环在8秒后执行.我希望它从页面加载的第一秒开始.怎么做.
javascript ×1