I have a button that displays a quote and author from an array. I need the button to display a new quote/author each time the button is clicked. No two same quotes/authors in a row!
window.onload = function()
{
    //assign var to quoteText id contents
    var quoteSpan = document.getElementById("quoteText");
    //assign var to authorText id contents
    var authorSpan = document.getElementById("authorText");
    var oldQuoteIndex = -1;
    var submitButton = document.getElementById('submit');
    var quotes = [
        {'text': 'I like milk!', 'author': '-Biff'}, 
        {'text': 'Milk is nasty.', 'author': '-Jonn'}, 
        {'text': 'What do you mean?', 'author': '-Jay'}, 
        {'text': 'Milk. Mmm.', 'author': '-Don'}, 
        {'text': 'Milk is bad.', 'author': '-Denny'}
    ];  
    //function determining random quote
    function nextQuote() {
        do
        {
            //picks random quote from quotes arraw
            var newQuoteIndex = Math.floor(Math.random() * quotes.length);
        } while (newQuoteIndex == oldQuoteIndex); //while index of newly chosen quote is the same as the index of old quote
        quoteSpan.innerHTML = quotes[newQuoteIndex].text; //while HTML's quoteText has random quote
        authorSpan.innerHTML = quotes[newQuoteIndex].author; //while HTML's authorText has random author
        var oldQuoteIndex = newQuoteIndex; //while old index is same as new index
    }
    //when button is clicked, quotation function starts
    submitButton.onclick = nextQuote;
}
 
     
     
    