1. use window.onload
2. getElementsByClassName returns an array, so you need to loop through that to get the elements
so...
window.onload = function () {
document.getElementById("nombreDeLista").onclick = function () {
var arr = document.getElementsByClassName("tiposDeFrutas");
for (var i = 0; i < arr.length; i++) {
arr[i].style.display = 'block';
}
}
}