samedi 18 septembre 2021

How to reload a video everytime web page is reloaded

I wanted a function that could change my background everytime I reload the page, but it ain't working.


 <script  type="text/javascript">
  var source = document.getElementById('video-source');
  var videos = [
  "videos/vid1.mp4",
  "videos/vid2.mp4",
  "videos/vid3.mp4"
];

  var randomVideo = videos[Math.floor(Math.random() * 3)];

source.setAttribute('src', randomVideo);
</script>
  



Aucun commentaire:

Enregistrer un commentaire