Hi there,
I am new in web development. I think this problem is related to javascript. My javascript script is below which changes images after 2 sec. But when i call my start function in img tag in my third row div of my layout, it does not show images in that div or in that area. It show that series of images in first row.

<script>

var images = new Array ("img/1.jpg", "img/2.jpg", "img/3.jpg");
var currentIndex = 0;


function Start()
{
setInterval("ChangeImage()", 2000);
}

function ChangeImage()
{
currentIndex++;
if(currentIndex == images.length)
{
currentIndex = 0;
}

document.images[0].src = images[currentIndex];
}
</script>

first div in html:

<div id="menu">
<img src="header/menu.png" name="menu" id="m"/>
</div>

My slideshow images places here, u can see i have call Start() function in another div.

3rd div html:

<div id="slideshow-img">
<img src="img/3.jpg" name="myimg" id="myimg" onclick="Start()"/>
</div>

Please resolve my problem as soon as possible, I'll highly appreciate.

change this line:

document.images[0].src = images[currentIndex];

to this:

document.images[1].src = images[currentIndex];

you see I have change array index to 1. When index is 0 then it changes images for first img tag.

commented: clear concise and explained! +1

Thaaaaaaaaaaaaaaaaaaaaaanx alot !!!!!!!!!!!!!!!!!

Hey new_developer,

Sure is great to get a solid answer like that, huh!?! This is a great forum.

Please be sure to marked this thread as solved, and give the responder's post a bump up (the up arrow under the Permalink).

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.