Perfecting quotes
This commit is contained in:
parent
69c967a9b2
commit
c6451b9e57
@ -44,6 +44,10 @@ window.getCookie = function(cname) {
|
|||||||
window.genQuote = function() {
|
window.genQuote = function() {
|
||||||
quotes = window.quotes
|
quotes = window.quotes
|
||||||
quote = Math.floor(Math.random() * quotes.length);
|
quote = Math.floor(Math.random() * quotes.length);
|
||||||
|
if(quote == window.quote) ++quote;
|
||||||
|
if(quote > quotes.length) quote -= 2;
|
||||||
|
if(quote < quotes.length) /* give up */ ++quote;
|
||||||
|
window.quote = quote;
|
||||||
document.getElementById('getaquote').setAttribute('value', 'Get another free quote today!');
|
document.getElementById('getaquote').setAttribute('value', 'Get another free quote today!');
|
||||||
document.getElementById('quote').textContent = '\"' + quotes[quote][0] + '\"';
|
document.getElementById('quote').textContent = '\"' + quotes[quote][0] + '\"';
|
||||||
document.getElementById('quoteauthor').textContent = '~ ' + quotes[quote][1];
|
document.getElementById('quoteauthor').textContent = '~ ' + quotes[quote][1];
|
||||||
|
Loading…
Reference in New Issue
Block a user