javascript - Slideshow in JS -


i trying make simple slideshow of 3 pictures in js.

i wrote following code in <head> code </head>, not working.

the problem, suspect, brackets. however, far can see, brackets match up.

but delete last 2 } brackets, , re add them, when type in first one, says mismatched bracket, when type second one, matches { bracket beside function line.

here code. have created forward , backward buttons in body of site call function, , appear on site, when click buttons, nothing happens, due bracket problem can't figure out.

above function line, included title, script tags js, , made array called pictures 3 pictures in (the pics did not end in jpg, might problem??).

i set array 0.

function runslideshow(forwardback){                                                                                                             if  (document.images){                                                                                                                       currentpicture = currentpicture + forwardback                                                                                            if (currentpicture > (pictures.length-1) )    {                                                                                              currentpicture=0                                                                                                                     }                                                                                                                                        if(currentpicture< 0){                                                                                                                       currentpicture=pictures.length-1                                                                                                     }                                                                                                                                         document.picturedisplay.src=pictures[currentpicture]                                                                                 } }  


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -