oldSetcolor = function(color) {
    var i;
    var elist = document.querySelectorAll("p");
    for (i = 0; i < elist.length; i++) {
        elist[i].style.color = color;
    }
}

setcolor = function(color) {
    var element;
    var elist = document.querySelectorAll("p");
    for (element of elist) {
        element.style.color = color;
    }
}

// removed old style of running init function
// window.onload = function() {

window.addEventListener('DOMContentLoaded', function() {
    var menu;
    menu = document.querySelector("#colorChoice");
    menu.addEventListener('change', function() {
        var selectedColor = document.querySelector("#colorChoice").value;
        setcolor(selectedColor);
    });
});