For the website for my webcomic, I’m trying to make it so that everytime you visit/refresh the website the image changes to be a different character. I spent hours trying to get this code on my website to work so the image changes on refresh, and i almost got it, however the images are way too big for the page and I cant figure out how to resize them. I tried to edit the images themselves but this is only a temporary solution as they are blurry and low quality, which is an issue because this is meant to be a website showcasing my artwork, and I don’t want my art to end up blurry, especially since this is on the first page you visit. I don’t like to use a separate CSS file for my page, as they confuse me and I like to have everything in one html file, though if there really is no other way then I’m willing to forego it.
Here’s what I have for my html:
table style="width: 81%; margin-left: calc(9%); margin-right: calc(10%);"><tbody><tr><img id="furFag"/>
</td>
<script langauge = javascript>
function getRandomImage() {
var images = ['/assets/those_guys/1.png', '/assets/those_guys/2.png', '/assets/those_guys/3.png', '/assets/those_guys/4.png'];
var image = images[Math.floor(Math.random()*images.length)];
return image;
}
function displayRandomImage() {
var htmlImage = document.getElementById("furFag");
htmlImage.src = getRandomImage();
}
displayRandomImage();
var images = ['/assets/those_guys/2.png', '/assets/those_guys/3.png', '/assets/those_guys/4.png'];
var htmlImage = document.getElementById("furFag");
</script>
If anyone is able to help it’d be much appreciated!! Thank you :3