use js to make html button update select tag onchange function
<p>Running the code as is will simply show you what my core purpose is. Just displaying rearranged data. But I'm trying to add NEXT and PREVIOUS buttons to go to the next option in the select drop menu in order to lessen the miles on the mouse. I don't have any code/function for the PREVIOUS button yet since I'm trying to find success with coding the NEXT button. You can use my comments in the code to guide you further. And I'm not using jQuery.</p>
<p>Be aware that the numbers (store numbers) are not perfectly sequential. Hence the &quot;+ 1&quot; isn't really a good idea.</p>
<p>How would I code the buttons to cycle through the Select tag options back and forth?</p>
<pre><code>&lt;body&gt;

&lt;p id=&quot;display1&quot;&gt;&lt;p/&gt; &lt;!--Used for debugging--&gt;
&lt;button type=&quot;button&quot; onclick=&quot;previousButton()&quot;&gt;Previous Store&lt;/button&gt;&lt;!--Unused for now--&gt;
&lt;button type=&quot;button&quot; onclick=&quot;nextButton()&quot;&gt;Next Store&lt;/button&gt;
&lt;p&gt;STORE NUMBER: &lt;select id=&quot;mySelect&quot; onchange=&quot;storeRequest()&quot;&gt;
    &lt;option value=&quot;00&quot;&gt;00
    &lt;option value=&quot;01&quot;&gt;01
    &lt;option value=&quot;02&quot;&gt;02
    &lt;option value=&quot;03&quot;&gt;03
    &lt;option value=&quot;04&quot;&gt;04
    &lt;option value=&quot;05&quot;&gt;05
    &lt;option value=&quot;06&quot;&gt;06
    &lt;option value=&quot;08&quot;&gt;08
    &lt;option value=&quot;56&quot;&gt;56
&lt;/select&gt;

&lt;/p&gt;

&lt;ol id=&quot;showpages&quot;&gt;&lt;/ol&gt;

&lt;/body&gt;


&lt;script type=&quot;text/javascript&quot;&gt;



//function below is object constructor for Page objects.
function page(name, storeNumS) {
    this.name = name;
    this.storeNumS = storeNumS;
    this.storesArray = storeNumS.split(&quot; &quot;)
}


// Below are some test instances of the page objects
// JS-program's goal is to rearrange the data, then display it
var _001_01 = new page(&quot;_001_01&quot;, &quot;01 03 05 56 06 08&quot;);
var _001_02 = new page(&quot;_001_02&quot;, &quot;01 02 03 04 05 08&quot;);
var _002_01 = new page(&quot;_002_01&quot;, &quot;02 03 04 56 06 08&quot;);
var _002_02 = new page(&quot;_002_02&quot;, &quot;02 03 04 56 06 08&quot;);

// All the above pages in an array
var allPagesArray = [_001_01, _001_02, _002_01, _002_02]; 

// This function gets the &lt;select&gt; option, then runs the search function
var storeRequest = function() {
    var request = document.getElementById(&quot;mySelect&quot;).value;
    searchObjAry(request);
}


// Below is the function I'd like help in.
// Havent created a funciton for &quot;Previous Button&quot; since am 
//  trying to figure out &quot;Next&quot; Button currently.
//  Hence &quot;previousButton()&quot; doesn't exist yet

var nextButton = function(nextRqst) {
    var request = document.getElementById(&quot;mySelect&quot;).value;
    var nextRqst = request + 1; // or rather goto next option on select tag list
    searchObjAry(nextRqst);
    // Used the line below to test the function
    // document.getElementById(&quot;display1&quot;).innerHTML = nextRqst;
}


// The function below will search for requested store in every page,
//  then create a list and update the DOM
var searchObjAry = function (storeNum){
    var orderedPgList = &quot;&quot;;
    var pageList = [];
    for (i = 0; i &lt; allPagesArray.length; i++){
        
        for (j = 0; j &lt; allPagesArray[i].storesArray.length; j++){
            if ( allPagesArray[i].storesArray[j] === storeNum){
                pageList.push(allPagesArray[i].name);
                
            }
        }       
    }
    for (k = 0; k &lt; pageList.length; k++) {
        orderedPgList += &quot;&lt;li&gt;&quot;  + pageList[k] + &quot;&lt;/li&gt;&quot;;
    }
    document.getElementById(&quot;showpages&quot;).innerHTML = orderedPgList;
        
    return; // &lt;-- still have no idea what &quot;return&quot; really does. Not sure if it'll mess anything up later.
}
&lt;/script&gt;
</code></pre>
<p>UPDATE: April 5th 2016.
Thanks to user2314727, i was able to learn that the &quot;select&quot; can act like an array and the it's &quot;options&quot; act as the indexed items. and fiddling around with my code again last night through the help of google, i came with the solution below. adding the &quot;.value&quot; keyword to @user...'s contribution, i was able to process the option's value in the searchObjAry() func.<br />
Only Problem left to fix is to make the PreviousButton cycle back to the bottom of the list and go backwards repeatedly the same way the NextButton works forwardly.</p>
<pre><code>var nextButton = function() {
    var request = document.getElementById(&quot;mySelect&quot;);
    var nxtIndx = request.options[request.selectedIndex += 1].value;
    searchObjAry(nxtIndx);
}

var previousButton = function() {
    var request = document.getElementById(&quot;mySelect&quot;);
    var prevIndx = request.options[request.selectedIndex -= 1].value;
    if (prevIndx !== request[0]){
        searchObjAry(prevIndx);
    }else if (prevIndx === request[0]){
        prevIndx = request.options[request.selectedIndex = 8].value;
        searchObjAry(prevIndx);
    }
    
}
</code></pre>