Iv got this script which changes the image using simple next and previous buttos from a predefined list, however it doesnt change the name or “title” of the image. seems like some code is missing? Can anyone help?
[CODE]<!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”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Simple slideshow</title>
<script type=”text/javascript”>
/* <![CDATA[ */
var pots = [
{
“title”:”Aubergines”,
“path”:”images/front.jpg” },
{
“title”:”Pineapple and Tofu”,
“path”:”images/side.jpg” },
{
“title”:”Rabbit”,
“path”:”images/large.jpg”},
{
“title”:”Blueberry Pies”,
“path”:”images/blueberries_pie.jpg”}
];
var pos = 0;
function switchImage() {
if (pos>=pots.length)
pos=0;
else if(pos<0)
pos=pots.length-1;
document.images[0].src=pots[pos][“path”];
}
/* ]]> */
</script>
</head>
<body onload=”javascript:document.getElementById(‘title’).innerHTML=pots[pos][‘title’];”>
<h1 style=”text-align:center”>Very basic slide-show</h1>
<div style=”text-align:center”>
<p><img src=”images/front.jpg” alt=”Recipes” /></p>
<p id=”title”> </p>
<p style=”text-align:center”><a href=”javascript:pos–;switchImage();”>previous</a> <a href=”javascript:pos++;switchImage();”>next</a>
</p>
</div>
</body>
</html>
thanks.