473,503 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with JAVASCRIPT SLIDESHOW

1 New Member
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 1264
dorinbogdan
839 Recognized Expert Contributor
See this simple tutorial .
Feb 16 '07 #2

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

Similar topics

6
2131
by: Terry | last post by:
Hi, I hope this problem I ran into has an easy fix. I created a menu bar for my page using Sothink DHTML Menu 4.1 which created javascript file. I also add a small slide show on the page...
6
1644
by: Patrick Fitzgerald | last post by:
I have a GNU licensed Javascript slideshow script: http://slideshow.barelyfitz.com/ Recently some users have complained about problems in Mac IE; unfortunately I don't have a Mac system that I...
16
2854
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed...
6
2364
by: Dan Webb | last post by:
Hi All, Im currently working on ways of pacakaging javascript functions/variables/objects in a similar way to the Java package statement so that scripts can be interact with each other with the...
1
1506
by: scorpion53061 | last post by:
I really like this javascript for an image slideshow. The only thing I woudl like to do differently is have a cell above the image and navigation that would allow text content to be placed. Does...
4
2716
by: CB US 77 | last post by:
I use a piece of javascript to create a photo gallery slideshow. The slideshow part works great, but I would like to add captions to each picture. If you want to see the html, send me an email to...
5
4112
by: Brian.Steele | last post by:
Greetings everyone. See http://www.spiceisle.com/cgi-bin/slideshow/slideshow.cgi?dir=brian/personal/2005/uk_trip/images&type=jpg The "Pause" button works in IE, but not in Firefox. Any ideas...
22
5096
by: bevoldjling | last post by:
Hi ! I need some help in putting together a website for our family gathering. Although I'm still pretty "green", I don't think what I need requires terribly advanced skills ...except for one...
8
1514
by: GabrielESandoval | last post by:
i currently use the code below to create a slideshow of images. i edited it so that its not as long. i currently have over 20 images i want to change it so that the images dont appear in the...
6
2378
by: mrtaka79 | last post by:
Okay, first of all, I'm a complete noob, so go easy on me. I have this code that works perfectly for me. The only thing I want to add is to randomize the pictures/links that show up. Can anyone...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.