Buenas, tengo el siguiente código en codepen: https://codepen.io/SidPendragon/pen/vpxbOW
var quotes = [
'“All war is a symptom of man\'s failure as a thinking animal.” ― John Steinbeck',
'“Strictly speaking, we do not make decisions, decisions make us.” ― José Saramago',
'“The only way to deal with an unfree world is to become so absolutely free that your very existence is an act of rebellion.” ― Albert Camus',
'“A lie is more comfortable than doubt, more useful than love, more lasting than truth.” ― Gabriel García Márquez',
'“Try again. Fail again. Fail better.” ― Samuel Beckett',
'“No man chooses evil because it is evil; he only mistakes it for happiness, the good he seeks.” ― Mary Shelley',
'“The constant happiness is curiosity.” ― Alice Munro',
'“Always do sober what you said you\'d do drunk. That will teach you to keep your mouth shut.” ― Ernest Hemingway',
];
function show() {
document.getElementById("ShowQuotes").innerHTML = quotes[0];
}
window.onload = show;
function next() {
for (var i = 0; i < quotes.length; i++) {
var nextquote = //Aquí es donde me pierdo.
}
document.getElementById("ShowQuotes").innerHTML = nextquote;
}
Lo que quiero es que al dar click en next se muestre el elemento siguiente del array pero no logro darme cuenta de como podría hacerlo. También quiero saber como podría hacerlos retroceder al hacer click en otro enlace.
Espero que porfavor alguien pueda ayudarme, lo agardecería mucho porque como pueden notar soy muy novato con javascript.