June 19, 200421 yr I'm trying to set up a random image script for a website, but none of the ones I find work. Anyone that could help please let me know. I'm trying to have at least 7 random images.tthanks in advance,Paradigm
June 19, 200421 yr Yeah, i didnt think you could generate that with html. Yes, as das said, i think php is the answer...but that is some complicated stuff.
June 19, 200421 yr DHTML is good, www.dynamicdrive.com Thousands of menus, form effects, interactive goodies etc etc and its all free...
June 19, 200421 yr Author ! I fixed the scrollbar issue.. thanks for help there i think..? Anyways on to the random image
June 20, 200421 yr Go talk to TCO(ThChosenOne)his sites, forums, and his sig changes images at each view
June 20, 200421 yr I have here a little JavaScript that rotate a number (3) of pictures: <SCRIPT LANGUAGE="JavaScript"> var number = 1; function rotate() { if (++number > 3) number = 1; document.images[0].src = "picture" + number + ".jpg"; window.setTimeout('rotate();',8000); } </SCRIPT> <BODY onLoad="window.setTimeout('rotate();',8000);"> the pictures must have the name picture1.jpg / picture2.jpg / picture3.jpg or you change the blue text... hope it helps...
June 20, 200421 yr Author Thanks panther, but it's really not what I'm looking for :\Anyone else able to help?
June 20, 200421 yr another question...do u want the pictures to change randomly without reloading the page, or a random picture shown at each new pageload ???u have to be a little more specific...but Clays answer and possible solution may be the easiest for u...
June 21, 200421 yr well...... with flash you could have it doing both, that's either a random image each pageload or a random image every so often.. but the images would have to be imbedded into the flash (well, technically they wouldn't, but it'd have to have a list of the images to choose from, which would make it more awkward to add new ones). javascript is... well... javascript. so it's sucky.php is the way to go. all you need to do is have a folder into which you shove all of the images you want it to reandomly select fromin this example the subfolder is "images"<?php$d=opendir(getcwd() . "/images");$filecount=0;$selected=0;$n=0;while($file=readdir($d)){ $filecount+=1;}rewinddir($d);$selected=mt_rand(3,$filecount);for($n=1;$n<=$selected;$n++){ $file=readdir($d);}echo "<img src='images/$file'>";?>so there you go... (i think) :slol
June 21, 200421 yr Author It isn't for a sig.. just a random image to show up on the webpage, such as the "random images" in the top right on the armorys main page.
June 22, 200421 yr <script><!-- var pic, alt;pic = new Array;pic[0] = "pic1.jpg";pic[1] = "pic2.jpg";pic[2] = "pic3.jpg"; pic[3] = "pic4.jpg"; pic[4] = "pic5.jpg"; pic[5] = "pic6.jpg"; pic[6] = "pic7.jpg";alt = new Array;alt[0] = "";alt[1] = "";alt[2] = ""; var now = new Date();var seed = now.getTime() % 0xffffffff;function rand(n) {seed = (0x015a4e35 * seed) % 0x7fffffff;return ( seed >> 16 ) % n;} var num = rand(7);document.write("<img alt='" + alt[num] + "' name='main_image' src='" + pic[num] + "' width='569' height='334' usemap='#Map' border='0' ></a>"); //--></script>
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.