By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,713 Members | 1,310 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,713 IT Pros & Developers. It's quick & easy.

Help with JAVASCRIPT SLIDESHOW

P: 1
Does anyone know how to do a Javascript Slideshow with a loop i have a code but i cant get it to work:

this is the code:

Expand|Select|Wrap|Line Numbers
  1. picno = 0
  2.  
  3. function showpic(item)
  4. {
  5.     document.getElementById("pic0").src = item.href
  6.     document.getElementById("subtitle").firstChild.nodeValue = item.title
  7.     tim= setTimeout("timer()", 4000)
  8.     return false
  9.     }
  10.  
  11. function nextpic()
  12. {
  13.     picno = picno + 1
  14.     whichpic = "pic" + picno
  15.     bigpic = document.getElementById("pic0")
  16.     newpic = document.getElementById(whichpic)
  17.     bigpic.src = newpic.href
  18.     if (picno >=5){picno=0}
  19.     return false
  20. }
  21.  
  22. function randomimage()
  23. {
  24.  
  25.     picno = Math.floor(Math.random() * 5) + 1
  26.     whichpic = "pic" + picno
  27.     bigpic = document.getElementById("pic0")
  28.     newpic = document.getElementById(whichpic)
  29.     bigpic.src = newpic.href
  30.     return false
  31. }
  32.  
  33. function timer()
  34. {
  35.     document.getElementById("pic0").src = "paul.png"
  36.  
  37.     }
  38.  
  39. function slideshow()
  40. {
  41.     tim= setTimeout("timer()", 4000)
  42.     picno = picno + 1
  43.     whichpic = "pic" + picno
  44.     bigpic = document.getElementById("pic0")
  45.     newpic = document.getElementById(whichpic)
  46.     bigpic.src = newpic.href
  47.     if (picno <5)
  48.  
  49.     return false
  50. }
Feb 15 '07 #1
Share this Question
Share on Google+
1 Reply

dorinbogdan
Expert 100+
P: 839
See this simple tutorial .
Feb 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.