Can somebody help me? I’m a noob, so talk down to me. I need help with a random .swf script. The script I have works fine but I want to modify it so that the same .swf banner will not load twice in a row. As it is now, being completely random, I often get the same banner five or six times in a row. Here is my script as it is now:
<script language=”JavaScript”>
// Generate a Random Number
var randomnumber = Math.round(Math.random()*5);
// Select a movie and execute the corresponding function
if (randomnumber == 1)
{movie1();}
else if (randomnumber == 2)
{movie2();}
else if (randomnumber == 3)
{movie3();}
else if (randomnumber == 4)
{movie4();}
else {movie5();}
//Functions to write out the correct flash movie resource.
function movie1(){
document.write(“<object classid=”clsid?27CDB6E-AE6D-11cf-96B8-444553540000”
codebase=”
width=”778″ height=”146″><param name=movie value=”movie1.swf”><param name=quality
value=high><embed src=”movie1.swf” quality=high
pluginspage=”
ash” type=”application/x-shockwave-flash” width=”778″ height=”146″></embed></object>”)
}
function movie2(){
document.write(“<object classid=”clsid?27CDB6E-AE6D-11cf-96B8-444553540000”
codebase=”
width=”778″ height=”146″><param name=movie value=”movie2.swf”><param name=quality
value=high><embed src=”movie2.swf” quality=high
pluginspage=”
ash” type=”application/x-shockwave-flash” width=”778″ height=”146″></embed></object>”)
}
function movie3(){
document.write(“<object classid=”clsid?27CDB6E-AE6D-11cf-96B8-444553540000”
codebase=”
width=”778″ height=”146″><param name=movie value=”movie3.swf”><param name=quality
value=high><embed src=”movie3.swf” quality=high
pluginspage=”
ash” type=”application/x-shockwave-flash” width=”778″ height=”146″></embed></object>”)
}
function movie4(){
document.write(“<object classid=”clsid?27CDB6E-AE6D-11cf-96B8-444553540000”
codebase=”
width=”778″ height=”146″><param name=movie value=”movie4.swf”><param name=quality
value=high><embed src=”movie4.swf” quality=high
pluginspage=”
ash” type=”application/x-shockwave-flash” width=”778″ height=”146″></embed></object>”)
}
function movie5(){
document.write(“<object classid=”clsid?27CDB6E-AE6D-11cf-96B8-444553540000”
codebase=”
width=”778″ height=”146″><param name=movie value=”movie5.swf”><param name=quality
value=high><embed src=”movie5.swf” quality=high
pluginspage=”
ash” type=”application/x-shockwave-flash” width=”778″ height=”146″></embed></object>”)
}
</script>