I am trying to get a div to automatically cycle through images using dreamweaver. I have gotten one image to display but nothing happens after this. Can anyone see where i am going wrong?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="Assets/styles.css" rel="stylesheet" type="text/css" />

NewImg = new Array (
/* as many or few images and the path <strong class="highlight"><vb_highlight>to</strong></vb_highlight> them */

var ImgNum = 5;
var ImgLength = NewImg.length - 1;
var delay = 3000; /* Time delay between Slides in milliseconds */
var lock = false;
var run;

function chgImg(direction) {
 if (document.images) {
  ImgNum = ImgNum + direction;
  if (ImgNum > ImgLength) {  ImgNum = 0; }
  if (ImgNum < 0) { ImgNum = ImgLength; }
 document.getElementById('slideshow').src = NewImg[ImgNum];

function auto() {
 if (lock == true) { 
  lock = false;
 else if (lock == false) {
  lock = true;
  run = setInterval("chgImg(1)", delay);

<div id="Shell">

  <div id="header">
  <img src="Images/images%3A1.jpg" name="slideshow"><br>
	<a href="images<b></b>:chgImg(-1)">Previous</a> &nbsp;|&nbsp; 
	<a href="images<b></b>:auto()">Auto/Stop</a> &nbsp;|&nbsp; 
	<a href="images<b></b>:chgImg(1)">Next</a>
7 Years
Discussion Span
Last Post by colweb

Never worked with dreamweaver, so can't say anything about that other than that I never heard anything good about it.

The following code will do a slideshow. You may want to adjust some variables and the images are not in a div here, but in a table. But it is not that hard to change that. And the images used here are very small, (240 by 306px). If yours are bigger just change the size accordingly. The ,6 behind the last image means a delay of 6 seconds.

The script works in IE 5 and up, Firefox 2 and up and probably all others as well.

In the header part:

<script type="text/javascript">
	var slideCache = new Array();

	function RunSlideShow(pictureName,imageFiles,displaySecs) {
		var imageSeparator = imageFiles.indexOf(";");
		var nextImage = imageFiles.substring(0,imageSeparator);
		if (document.all) {
		document.getElementById(pictureName).src = nextImage;
		if (document.all) {
		var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length) + ';' + nextImage;
		// Cache the next image to improve performance.
		imageSeparator = futureImages.indexOf(";");
		nextImage = futureImages.substring(0,imageSeparator);
		if (slideCache[nextImage] == null) {
			slideCache[nextImage] = new Image;
			slideCache[nextImage].src = nextImage;

In the body part: (class img = border:thin solid yellow; max-width:400px; padding:0;)

<table class="img" align="center">
			<img style="" id="foto" src="/images/opening/img01.jpg" height="240" width="306">
<script language="JavaScript" type="text/javascript">
		+ "/images/opening/img02.jpg;"
		+ "/images/opening/img03.jpg;"
		+ "/images/opening/img04.jpg;"
		+ "/images/opening/img05.jpg;"
		+ "/images/opening/img06.jpg;"
		+ "/images/opening/img07.jpg;"
		+ "/images/opening/img08.jpg;"
		+ "/images/opening/img09.jpg;"
		+ "/images/opening/img10.jpg;"
		+ "/images/opening/img11.jpg;"
		+ "/images/opening/img12.jpg",6);

Awesome, thankyou so much :)

Please remember to mark a solved thread as solved. Thank you.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.