Initially, I'm facing an issue with morscreens[i] not displaying the desired image from the array. When left as it is, it ends up showing a [<] button followed by "morscreens[i]" and then a [>] button. However, enclosing morscreens[i] in quotes causes an error stating that morshots() is not defined.
Furthermore, if I aim to cycle through the buttons, would it be advisable to utilize subroutines like morPrev() and morNext()? My concern revolves around potentially encountering scope-related challenges when trying to return the desired value and correctly placing it in the required locations. Simply incrementing and decrementing i using i++ and i-- may not suffice for achieving the intended functionality, even with the presence of 2 conditional statements.
var mordorscreens = new Array();
mordorscreens[0] = '<img src=\"http://i.imgur.com/83HCt.png\" alt=\"scrns1\">';
mordorscreens[1] = '<img src=\"http://i.imgur.com/5mWIy.png\" alt=\"scrns1\">';
mordorscreens[2] = '<img src=\"http://i.imgur.com/pPafl.png\" alt=\"scrns1\">';
function morshots()
{
var i = 0;
var mordor = document.getElementById("ss1");
mordor.innerHTML = '<button onClick="morPrev();"> < </button> ' + mordorscreens[i] + ' <button onClick="morNext();"> > </button> ';
if (i<0) {i=2};
if (i>2) {i=0};
}