M
mikeoley
Ok I have a Javascript slideshow working. Every image is linked to a
another page in the site. Problem is...The link wont refresh to the
next link once the second images rollovers in the slideshow. It only
stays at the first images link.
Is this a cache issue? Or is there anyway to create a random number to
trick this or make it work properly. I'm very raw with Javascript so
I'm having trouble figuring this out.
Thank you in advance
Site:
http://www.aircylindersdirect.com/egtest/
Code:
<script type="text/javascript">
<!--
/* define image width and height */
var pic_width=550;
var pic_height=245;
/* define image urls */
if (document.images)
{
pic1= new Image(550,245);
pic1.src="images/main-nrseries.gif";
pic2= new Image(550,245);
pic2.src="images/main-enseries.gif";
pic3= new Image(550,245);
pic3.src="images/main-evseries.gif";
pic4= new Image(550,245);
pic4.src="images/main-mciseries.gif";
pic5= new Image(550,245);
pic5.src="images/main-enlseries.gif";
pic6= new Image(550,245);
pic6.src="images/main-ensseries.gif";
pic7= new Image(550,245);
pic7.src="images/main-customseries.gif";
}
/* define text for image captions */
var pics= new Array(7)
pics[0]=pic1.src;
pics[1]=pic2.src;
pics[2]=pic3.src;
pics[3]=pic4.src;
pics[4]=pic5.src;
pics[5]=pic6.src;
pics[6]=pic7.src;
var links = new Array(7);
links[0]="products/nrseries.jsp";
links[1]="products/enseries.jsp";
links[2]="products/evseries.jsp";
links[3]="products/mciseries.jsp";
links[4]="products/enlseries.jsp";
links[5]="products/ensseries.jsp";
links[6]="products/customseries.jsp";
var numpics=7;
var thenum=0;
imgName="img1";
function change_it()
{
if (document.images)
{
document.write("<a href = " + links[thenum] + "><img
src='"+pics[thenum]+"' border='0' width='"+pic_width+"'
height='"+pic_height+"' name='img1'></a>\n");
setTimeout('change_it2()',4000);
}
}
function change_it2()
{
var x=0;
thenum+=1;
if (thenum>numpics-1)
thenum=0;
document[imgName].src=pics[thenum];
x+=1;
setTimeout('change_it2()',4000);
}
//-->
</script>
another page in the site. Problem is...The link wont refresh to the
next link once the second images rollovers in the slideshow. It only
stays at the first images link.
Is this a cache issue? Or is there anyway to create a random number to
trick this or make it work properly. I'm very raw with Javascript so
I'm having trouble figuring this out.
Thank you in advance
Site:
http://www.aircylindersdirect.com/egtest/
Code:
<script type="text/javascript">
<!--
/* define image width and height */
var pic_width=550;
var pic_height=245;
/* define image urls */
if (document.images)
{
pic1= new Image(550,245);
pic1.src="images/main-nrseries.gif";
pic2= new Image(550,245);
pic2.src="images/main-enseries.gif";
pic3= new Image(550,245);
pic3.src="images/main-evseries.gif";
pic4= new Image(550,245);
pic4.src="images/main-mciseries.gif";
pic5= new Image(550,245);
pic5.src="images/main-enlseries.gif";
pic6= new Image(550,245);
pic6.src="images/main-ensseries.gif";
pic7= new Image(550,245);
pic7.src="images/main-customseries.gif";
}
/* define text for image captions */
var pics= new Array(7)
pics[0]=pic1.src;
pics[1]=pic2.src;
pics[2]=pic3.src;
pics[3]=pic4.src;
pics[4]=pic5.src;
pics[5]=pic6.src;
pics[6]=pic7.src;
var links = new Array(7);
links[0]="products/nrseries.jsp";
links[1]="products/enseries.jsp";
links[2]="products/evseries.jsp";
links[3]="products/mciseries.jsp";
links[4]="products/enlseries.jsp";
links[5]="products/ensseries.jsp";
links[6]="products/customseries.jsp";
var numpics=7;
var thenum=0;
imgName="img1";
function change_it()
{
if (document.images)
{
document.write("<a href = " + links[thenum] + "><img
src='"+pics[thenum]+"' border='0' width='"+pic_width+"'
height='"+pic_height+"' name='img1'></a>\n");
setTimeout('change_it2()',4000);
}
}
function change_it2()
{
var x=0;
thenum+=1;
if (thenum>numpics-1)
thenum=0;
document[imgName].src=pics[thenum];
x+=1;
setTimeout('change_it2()',4000);
}
//-->
</script>