Advertisement
guitarman0831

Untitled

Apr 16th, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var id = ["id1","id2","id3"]; //Array with the id's in the document you want to shuffle through
  2. function resetValue() {
  3.     var i = 0;
  4.     initiateTimer();
  5. }
  6. fuction initiateTimer() {
  7.     if(i > 3) {
  8.         resetValue();
  9.     }
  10.     var t = setTimeout(changeElement();, 5000)); //5000 = 5 seconds
  11. }
  12. function changeElement() {
  13.     document.getElementById(id[i-1]).style.display = 'none';
  14.     document.getElementById(id[i]).style.display = 'block';
  15.     i += 1;
  16.     initiateTimer();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement