Jump to content

Looping Slideshow


son
 Share

Recommended Posts

I am still a bit ropy with JavaScript and do not have the slightest clue how to make the basic slideshow loop. My code so far is:

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Slideshow</title><?php$query2 = "SELECT * FROM slides WHERE showroom = 0 ORDER BY rand()";$result2 = mysqli_query ($dbc, $query2);	if (mysqli_num_rows($result2) > 0)	{	echo "<script type=\"text/javascript\">\n";	echo "<!--\n";	$i = 1;		while ($row = mysqli_fetch_array ($result2, MYSQLI_ASSOC))			{		$img_id = $row['img_id'];		$img1 = $row['img1'];		echo "var image" . $i . "=new Image()\n";		echo "image" . $i . ".src=\"slides/main/" . $img1 . "\"\n";		if ($i ==1)		{		$feature = "slides/main/" . $img1;		}		$i++;		}echo "//-->\n";echo "</script>\n";	}?><style type="text/css"> body {background-color:#d1cc98; text-align:center; padding:30px;}</style></head><body><img src="<?php echo $feature; ?>" name="slide" width="600" height="400" /><script><!--//variable that will increment through the imagesvar step=1function slideit(){//if browser does not support the image object, exit.if (!document.images)returndocument.images.slide.src=eval("image"+step+".src")step++//call function "slideit()" every 2.5 secondssetTimeout("slideit()",2500)}slideit()//--></script></body>

I am sure it is just a basic thing, but would really appreciate any hints...Son

Edited by son
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...