Skip to content

Instantly share code, notes, and snippets.

@bforrest
Created April 5, 2023 18:28
Show Gist options
  • Save bforrest/b7a037d5431a946772ddf8a38653bc97 to your computer and use it in GitHub Desktop.
Save bforrest/b7a037d5431a946772ddf8a38653bc97 to your computer and use it in GitHub Desktop.
Image rotator
<img id="daily-image" alt="image of the day" />
<script>
// Get a reference to the img element
const img = document.getElementById('daily-image');
const baseUri = 'https://southshoreinsurance.sharepoint.com/SiteAssets/Forms/AllItems.aspx?id=%2FSiteAssets%2FDailyPhotos/';
var today = new Date().getDay();
var day;
switch (today) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
}
img.src = baseUri + day + '.png';
window.onload = function () {
GetJSON()
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment