Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Random file on page load... or at least that was the idea :(
- From: javascript@xxxxxxxxxx (McCoy, Thomas)
- Subject: [Javascript] Random file on page load... or at least that was the idea :(
- Date: Thu, 17 Oct 2002 10:00:15 -0700
Hello everyone!
I have a script which displays a random file when the page in loaded, but
sometimes it will display nothing. The "nothing" error rate is not
consistent. Any ideas?
Here is the script:
<script language="JavaScript">
<!-- Random Flash Player by Raphael Pirker (www.nr1webresource.com)
/* Let's make the Array of movies and the height and width. This is the only
block
you'll need to modify! Insert the path to the movies (you can add or remove
movies
as you wish!) and enter their height and width (in pixels)
That's all! You're ready to roll! */
var movies = new
Array("graphics/peaceprize3.swf","graphics/peaceprize3.swf","graphics/peacep
rize3.swf","graphics/peaceprize3.swf","graphics/peaceprize3.swf","graphics/p
eaceprize3.swf","graphics/peaceprize3.swf","graphics/peaceprize3.swf","graph
ics/peaceprize3.swf")
// Nothing needs to be edited here! Change at your own risk... :-)
len = movies.length;
today=new Date();
today=today.getTime()/10;
temp_number=today%len;
rnd = Math.round(temp_number);
// Output into the source:
document.writeln('<EMBED src="'+ movies[rnd] +'" quality=high
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_
Version=ShockwaveFlash" WIDTH="610" HEIGHT="200">');
document.writeln('</EMBED>');
// End of Script -->
</script>
See it in action (you'll have to keep refreshing the page to try and catch
an error) at:
http://www.city.newport-beach.ca.us/nbpl/greenroom/3/
I purposely made it load the same file randomly just to prove that it isn't
a corrupt Flash file.
Sincerely,
Thomas McCoy
The Supreme Javascript Lurker :0
- Follow-Ups:
- Prev by Date: [Fwd: [Javascript] moving layers in NN 6]
- Next by Date: [Javascript] Random file on page load... or at least that was the idea :(
- Previous by thread: [Fwd: [Javascript] moving layers in NN 6]
- Next by thread: [Javascript] Random file on page load... or at least that was the idea :(
- Index(es):