Windows Sidebar - Javascript countdown
I have created a Windows Sidebar Countdown gadget where there is a PIC in the BG and below it there's that countdown when finished it shows a text message , Now what I want to do is that I want to add a slideshow in the BG ( of 3 to 4 images) ...开发者_StackOverflow So experts please guide me with this.
You can use the setTimeout method from javascript, and after every few seconds change the background image in the body.
document.body.background = "image.gif"
eg.
setTimeout('changeImage(1)',1000);
function changeImage(i) { if i == 4 return;
document.body.background = 'image'+i+'.gif'; setTimeout('changeImage('+(i+1)+')',1000); }
You should have the images image1.gif, image2.gif and so on in the same folder as your gadget.html
精彩评论