/    Sign up×
Community /Pin to ProfileBookmark

Actionscripter Learning Javascript – First script! need help

okay, so i want to print out on the console.log screen,each index of the imagArray array , at an interval of 3 seconds, can someone tell me where my mistakes are ?

[code=php]var imageArray = [“imageone”, “imagetwo”,”imagethree”,”imagefour”,”imagefive”];
var curr = 0;
var timer=window.setInterval(“timerFunction”, 3000);

function timerFunction ( imagesArray )
{
this.imagesArray = imagesArray;
if ( curr <( imagesArray.length-1))
{

try {

console.log( “current images is : “+ imageArray[curr] );

}
catch (e)
{
}
// incremented via timer call instead of nextImage function;
curr = curr+1;
}
else
{
clearTimer(timer);
try{
console.log(“current image is last image : “+imageArray[curr]);
}
catch (e)
{
}
}
}

prev = function (curr)
{
if ( curr > 0 )
{
curr = curr – 1;
}
}

next = function (curr)
{
if ( curr < imageArray.length )
{
curr = curr +1;
}
}
document.setInterval = (timerFunction(imageArray), 3000);[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@enkriptidauthorJul 21.2010 — nevermind, ill figure it out , peace
×

Success!

Help @enkriptid spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...