...

View Full Version : Is it possible to combine these two functions?



ampulator00
07-06-2004, 03:03 AM
Is it possible to combine these two functions?

var thisPic = 0;

function chgSlide(direction)
{
imgCt = slideChoice[0].length -1;
if(document.images)
{
thisPic += direction;
if(thisPic > imgCt)
{
thisPic = 0;
}
if(thisPic < 0)
{
thisPic = imgCt;
}
document.getElementById(slideID[0]).src = slideChoice[0][thisPic]
}
}

function chgSlide1(direction)
{
imgCt = slideChoice[1].length -1;
if(document.images)
{
thisPic += direction;
if(thisPic > imgCt)
{
thisPic = 0;
}
if(thisPic < 0)
{
thisPic = imgCt;
}
document.getElementById(slideID[1]).src = slideChoice[1][thisPic]
}
}

squirellplaying
07-06-2004, 03:08 AM
var thisPic = 0;

function chgSlide(direction,x)
{
imgCt = slideChoice[x].length -1;
if(document.images)
{
thisPic += direction;
if(thisPic > imgCt)
{
thisPic = 0;
}
if(thisPic < 0)
{
thisPic = imgCt;
}
document.getElementById(slideID[x]).src = slideChoice[x][thisPic]
}
}

I think that works. Just pass in 0 or 1 for X.

ampulator00
07-06-2004, 03:13 AM
Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum