General912 Posted April 26, 2004 Posted April 26, 2004 ok i got this little script that randomizes what page to display, Im using it to display video clips. What i need is a way where it only displays the page one time threw the whole rotation. How would i do that? <script LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- // Set up the variables we need for the random URL selection. var uc = 5; // Number of URLs var u = new Array(uc); // Array to hold URLs // These are all local URLs; they could just as well be URLs // pointing to other machines, or a mixture of both. You // could even put mailto: or telnet: URLs in here. u[0] = "http://www.theembassyvfx.com/qt/tetra.mov"; u[1] = "http://www.apple.com/trailers/fox/i_robot/featurette/ap_lg.html"; u[2] = "http://a772.g.akamai.net/5/772/51/d738f317b7e112/1a1a1aaa2198c627970773d80669d84574a8d80d3cb12453c02589f25382f668c9329e0375e 8177dec6493fc5bcd3c9e0d81/i_robot-tlr1a_480.mov"; u[3] = "http://aimovie.warnerbros.com/dld/trailer3_hi.mov"; u[4] = "http://www.apple.com/trailers/wb/t3/domestictrailer/large.html"; // pickRandom - Return a random number in a given range. This // function is 'browser-proofed' to run correctly on older // browsers that don't implement 'Math.random'. function pickRandom(range) { if (Math.random) return Math.round(Math.random() * (range-1)); else { var now = new Date(); return (now.getTime() / 1000) % range; } } // Function: pickRandomURL // // A very simple function that selects one of the URLs in the // 'u' array at random, and returns it as a string. function pickRandomURL() { var choice = pickRandom(uc); return u[choice]; } // --> </SCRIPT> Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now