I"m trying to get a set of html files (with images with links) to randomly show on the sidebar of a site. I can get the name of the file to randomly show using this code:
function displayRandomMessage() {
var contentArea = [
'/includes/side2.htm',
'/includes/side3.htm',
'/includes/side4.htm'
];
var randomIndex = Math.floor(Math.random() * contentArea.length);
var randomMessage = contentArea[randomIndex];
var messageElement = document.getElementById("contentArea");
messageElement.innerHTML = randomMessage;
}
And putting this at the end of the page(s):
<script>
window.onload = displayRandomMessage;
</script>
I'm just not having much luck getting the actual html file to display.
Any help or point in the right direction would be greatly appreciated!
You can use
fetchto fetch the html