njman
Feb 1st 2008, 7:23 am
Hi, Im new here and really need some help on a javascript functions, as Im not too experienced with javascript code yet, and not quite sure how to approach this. I have a function to play a photo slide show with fade transitions. What can I use in place of Math.random so that the photos display in sequential order and not random order? Here is my existing code:
function doOn(_i,_n) {
eval("fade(document[\""+_i+"\"],_"+_n+".src)");
/* var next = ((_n+1)%11);
if(next==0)
next=1;
*/
var next = _n;
while(next == _n)
{
next = Math.round(1 * Math.random())+1;
}
if(timerv!=null)
clearTimeout(timerv);
timerv=setTimeout("doOn('"+_i+"',"+next+")",6000);
//alert("document[\""+_i+"\"].src="+_n+".src");
}
Thanks for any help you can give me. :)
NJ
function doOn(_i,_n) {
eval("fade(document[\""+_i+"\"],_"+_n+".src)");
/* var next = ((_n+1)%11);
if(next==0)
next=1;
*/
var next = _n;
while(next == _n)
{
next = Math.round(1 * Math.random())+1;
}
if(timerv!=null)
clearTimeout(timerv);
timerv=setTimeout("doOn('"+_i+"',"+next+")",6000);
//alert("document[\""+_i+"\"].src="+_n+".src");
}
Thanks for any help you can give me. :)
NJ