ebenzunlimited
Moderator
If you want to load different videos randomly on page refresh, this code may prove helpful.
Code:
<script type="text/javascript">
// Create an array with all the file names
var urls = [
"file_1.swf",
"file_2.swf"
]
// Create a random number between 0 and the length of the array
var randNumber = Math.floor(Math.random() * urls.length);
// There's a very tiny chance that the random number is too big
randNumber -= (randNumber == urls.length)?1:0;
// Select a filename from the array
var randomFile = urls[randNumber];
// I don't usually recommend using document.write(), for many reasons.
// But since this is supposed to load as soon as the page does, it's OK.
document.write("<object type=\"application/x-shockwave-flash\" data=\"" + radomFile + "\" width=\"500\" height=\"440\">");
document.write("<param name=\"movie\" value=\"" + randomFile + "\">");
document.write("</object>");
</script>