Lunarpages Web Hosting Forum

Author Topic: Ways to show images on a html page randomly  (Read 2239 times)

Offline Bluelight

  • Jedi
  • *****
  • Posts: 755
Ways to show images on a html page randomly
« on: August 24, 2001, 03:28:00 PM »
Is there a way besides gifs to show images randomly (if thats the word?)I would like it to be like if you come to my startpage there will be pic a and if you come back for example 1 hours later you`ll get pic b.
  Is there a solution for this.
 
  Blue
 

Offline Ice

  • Galactic Royalty
  • *****
  • Posts: 232
    • http://www.lunarpages.com/fsgin
Ways to show images on a html page randomly
« Reply #1 on: August 24, 2001, 07:59:00 AM »
Most definitely  

Though you'll actually need to use JS.  
Here are some links that might help you.

Random Image Link
Day-of-the-week image displayer
Random Image(out of 3)
Different Image(morning or night)

I'm sure there's more out there.   Just do a search for random images or similar.

Hope that helps  
Flipside Gin
A site for Cases ladder gin players at Flipside.com
 http://www.lunarpages.com/fsgin

Offline Shadowcrafter

  • Galactic Royalty
  • *****
  • Posts: 274
    • http://rbcb.lunarpages.com
Ways to show images on a html page randomly
« Reply #2 on: August 24, 2001, 09:50:00 AM »
http://kickme.to/ronnyb

bellow is what does what you ask,on my page.
its from macromedia so i dont know if it'll work for you or not(it include a small table)
Shadow


<table width="75%" align="center" height="82">
  <tr>
    <td height="86">
      <div align="center">
        <script language="JavaScript">
  var j,l="",m="",p="",q="",z="",list= new Array()
  list[list.length]='dvd12cr.gif';
  list[list.length]='cshq45.gif';
  list[list.length]='cdrw121032cr.jpg';
  j=parseInt(Math.random()*list.length);
  j=(isNaN(j))?0:j;
  if (list[j].indexOf('?')==-1) {
    document.write("<img src='"+list[j]+"'>");
  }
  else {
    nvp=list[j].substring(list[j].indexOf('?')+2).split('&');
    for(var i=0;i<nvp.length;i++) {
      sub=nvp.split('=');
        switch(sub[0]) {
        case 'link':
          l="<a href='"+unescape(sub[1])+"'>";
          p="</a>";
        break;
       case 'target':
          q=" target='"+unescape(sub[1])+"'";
          break;
         default:
          m+=" "+sub[0]+"='"+unescape(sub[1])+"'";
          break;
      }
    }
    z=(l!="")?((q!="")?l.substring(0,l.length-1)+q+">":l):"";
    z+="<img src='"+list[j].substring(0,list[j].indexOf('?'))+"'"+m+">"+p;
  document.write(z);
  }
</script>
      </div>
    </td>
  </tr>
</table>
I can't but help to darken
your doorstep, I'm a Shadow.

Offline Bluelight

  • Jedi
  • *****
  • Posts: 755
Ways to show images on a html page randomly
« Reply #3 on: August 25, 2001, 01:50:00 AM »
Thanks i`ll try both these solutions they will certainley work both in some way or another.Tell you when it`s done.

   Ice you amaze me.Always there.
   You should have 10 free big fat accounts in here for your work. He he...

   Blue.

  Ps IŽll start out with the code from Shadow that will be the most tricky to do i guess  as i know nothing about Html but i managed to fix something similar just with code given to me.Had to fool around awhile but finally it worked.Fun!