470,863 Members | 1,099 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,863 developers. It's quick & easy.

Help with JAVASCRIPT SLIDESHOW

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
1 1184
dorinbogdan
839 Expert 512MB
See this simple tutorial .
Feb 16 '07 #2

Post your reply

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

Similar topics

6 posts views Thread by Terry | last post: by
6 posts views Thread by Patrick Fitzgerald | last post: by
16 posts views Thread by Terry | last post: by
6 posts views Thread by Dan Webb | last post: by
1 post views Thread by scorpion53061 | last post: by
4 posts views Thread by CB US 77 | last post: by
22 posts views Thread by bevoldjling | last post: by
8 posts views Thread by GabrielESandoval | last post: by
6 posts views Thread by mrtaka79 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.