I posted before asking for a way to produce a random wallpaper from a list I had, but I was now wondering if instead of having 'images/bg-N.png' (N being a number), I could have something along the lines of this?
<script type="text/javascript">
var images = ['1', '2', '3', '5', '6', '7', '8', '9', '10'];
document.getElementsByClassName('mainview')[0].style.backgroundImage = 'url('"images/bg-" + images[Math.round(Math.random() * images.length)] + ".png"')';
</script>
This doesn't work, as I have very little knowledge about javascript itself. If anyone would be able to fix this for me I would be very grateful!
You don't need extra quotation marks.