I am new to this Java Scripting stuff so I am looking for a little help. I have seen posted in here JavaScript for randomly displaying .fla files.
What I am trying to accomplish is displaying flash banners in order (1.swf, 2.swf, 3.swf) along with a different url for each one. 1.swf always get the same url, 2.swf samething, etc.
I have tried the Flash file approach tageting the external flash banners but I am running into problems with the main flash file taking the flash banners and making there background color transparent. I have no clue on that, so I gave up and am not exploring the Javascript idea. I got everthing to work with this code but I dont know how to change it to do what I stated above.
Any help you guys could give me on this would be greatly appreciated.
Here is the code I need to change some how:
You'll are the greatest!!!
var movies = new Array("b1.swf", "b2.swf", "b3.swf")
var s_width = new Array("468","468","468")
var s_height = new Array("60","60","60")
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 WIDTH="'+ s_width[rnd] +'" HEIGHT="'+ s_height[rnd] +'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
document.writeln('</EMBED>');
<script>
<!--
/*
************************************************** *******
*** "God so loved the world that he gave his only ***
*** begotten son, so that whosoever believed in him ***
*** would not perish, but have everlasting life." ***
************************************************** *******
*/
Just change the banner names--add as many as you like. Increment the random multiplican by 1 for each new movie. Make sure that the document.write(); statement is all on the same line.
-james
Last edited by jamescover; 06-24-2004 at 11:42 PM.
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life."
I have placed your code into the html doc and nothing happens when the page loads.
I renamed all of my b#.swf files to reflex the file names you had in your script and still nothing.
If you just copied and pasted it, it is because this board splits the word javascript. After you've copied and pasted the script, go to the following line...
<body onload="javascript:ranMov();">
...and remove the space between java and script.
Also, I'm using IE 5.0 and the script doesn't work when I use the refresh button, instead of the go button to refresh the page.
-james
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life."
I have removed that space in the code. Now what happens is the page loads up and then...the page disappears and I get a 468 X 60 form box with the scroll bar on the RT hand side located at the top of the page, everything else is blank.
" I have removed that space in the code. Now what happens is the page loads up and then...the page disappears and I get a 468 X 60 form box with the scroll bar on the RT hand side located at the top of the page, everything else is blank. "
Sorry, I don't know what you mean by a form box . But the script is set up to serve 475x400 movies. You can just change the dimensions to suit the size of your banners.
Maybe, you're not familiar with what this script does--document.write(), writes to a new page. That is, it produces a new HTML page at runtime/on-the-fly, just like the script you posted originally. If that's not what you want it to do, you'll have to better explain what you're try to accomplish.
-james
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life."