jquery - Javascript : Change img src After some interval of time -
this question has answer here:
guys don't know how add interval of time in javascript. know how add time before changing src of image. code 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 smiley.gif, script changed landscape.jpg</p> </body> </html>
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 smiley.gif, script changed landscape.jpg</p>
i have updated fiddle
Comments
Post a Comment