伙计我不知道如何在javascript中添加一些时间间隔。你知道如何在更改图像的src之前添加一些时间。我从W3schools
获取此代码
document.getElementById("image").src = "http://www.w3schools.com/js/landscape.jpg";

<!DOCTYPE html>
<html>
<body>
<img id="image" src="http://www.w3schools.com/js/smiley.gif" width="160" height="120">
<p>The original image was smiley.gif, but the script changed it to landscape.jpg</p>
</body>
</html>
&#13;
答案 0 :(得分:3)
setTimeout(function() {
document.getElementById("image").setAttribute("src", "http://www.w3schools.com/js/landscape.jpg");
}, 5000);
<img id="image" src="http://www.w3schools.com/js/smiley.gif" width="160" height="120">
<p>The original image was smiley.gif, but the script changed it to landscape.jpg</p>
我已更新您的fiddle