Created
April 24, 2019 18:09
-
-
Save joshfitzgerald/bf7eae9575ef20ec2165338feed8f965 to your computer and use it in GitHub Desktop.
Replace content with random array item on page load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<blockquote id="quoteDisplay"></blockquote> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const quotes = [ | |
'<img src="images/abTest38713/UserTestimonial_01@2x.png" width="426" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_02@2x.png" width="408" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_03@2x.png" width="436" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_04@2x.png" width="361" height="77">', | |
'<img src="images/abTest38713/UserTestimonial_05@2x.png" width="411" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_06@2x.png" width="356" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_07@2x.png" width="351" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_08@2x.png" width="316" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_09@2x.png" width="351" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_10@2x.png" width="345" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_11@2x.png" width="396" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_12@2x.png" width="426" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_13@2x.png" width="291" height="76">', | |
'<img src="images/abTest38713/UserTestimonial_14@2x.png" width="346" height="77">', | |
'<img src="images/abTest38713/UserTestimonial_15@2x.png" width="346" height="76">' | |
] | |
window.addEventListener('load', function newQuote() | |
{ | |
let randomNumber = Math.floor(Math.random() * (quotes.length)); | |
document.getElementById('quoteDisplay').innerHTML = quotes[randomNumber]; | |
return quotes[randomNumber]; | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment