Lunarpages Web Hosting Forum

Advanced Lunarpages Assistance => Web Designer's Help and Resources => Topic started by: Bluelight on August 24, 2001, 03:28:00 PM

Title: Ways to show images on a html page randomly
Post by: Bluelight 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
 (http://images/smiles/icon_smile.gif)
Title: Ways to show images on a html page randomly
Post by: Ice on August 24, 2001, 07:59:00 AM
Most definitely  (http://images/smiles/icon_smile.gif)

Though you'll actually need to use JS.  (http://images/smiles/icon_smile.gif)
Here are some links that might help you.

Random Image Link (http://www.wsabstract.com/script/cut144.shtml)
Day-of-the-week image displayer (http://www.wsabstract.com/script/cut120.shtml)
Random Image(out of 3) (http://www.wsabstract.com/script/cut118.shtml)
Different Image(morning or night) (http://www.wsabstract.com/script/cut6.shtml)

I'm sure there's more out there.  (http://images/smiles/icon_smile.gif) Just do a search for random images or similar.

Hope that helps  (http://images/smiles/icon_biggrin.gif)
Title: Ways to show images on a html page randomly
Post by: Shadowcrafter on August 24, 2001, 09:50:00 AM
http://kickme.to/ronnyb (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>
Title: Ways to show images on a html page randomly
Post by: Bluelight 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!