You just started learning javascript
welcome;)
function loop(){
i=++i==3?1:i;
//i is : if i+1 is 3 then 1 else its i (the already i+1)
document.getElementById('image').src=(i==1?'html':'css3')+'.png';
//src is : if i is 1 then html else css3
}
var pictureloop=setInterval(loop,1000),i=1;
//set all vars you need separated by comma.
Demo
http://jsfiddle.net/9dZt6/1/
the right way
function loop(){
i=!i;
document.body.innerHTML=(i?'html':'css3')+'.png'
}
var pictureloop=setInterval(loop,1000),i=1;
Demo
http://jsfiddle.net/cRn6n/
another way: html5 css3
CSS
div{
background:#000 url(html.png) no-repeat center center;
background-size:contain;
}
div.odd{
background-image:url(css3.png);
}
Js
function toggle(){
var div1=document.getElementsByTagName('div')[0];
div1.classList.toggle('odd');
timer=window.setTimeout(toggle,1e3);
}
var timer=window.setTimeout(toggle,1e3);
:
function toggle(){
img.src=(img.src=='http://path/html.png'?'css3':'html')+'.png';
}
var img=document.getElementById('image'),
timer=window.setInterval(toggle,1e3);
+1 jquery
fooobar.com/questions/1682/...
, .