codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Swopping images using ASP  cherni99 at 12:35 on Thursday, May 27, 2004
 

Hi all,

I have read somewhere that this can be done but cant find the article anywhere!

I want to be able to swop an image on my website when a diff user arrives on it.
I have 3/4 different images and I want my site to alternate between the images on my home page.

Any ideas?

Thanks a mil.

  Re: Swopping images using ASP  cherni99 at 13:05 on Thursday, May 27, 2004
 

Hi again,

Sorry if wasted anyones time but i found the article and its easy and simple.

here it is(all thanks to Alexander Haneng - http://www.haneng.com/Lessons_2.asp)
I have altered the code somewhat (hope Alex doest mind)

<%
RANDOMIZE
LowestNumber = 1
HighestNumber = 10
RandomNumber = INT((HighestNumber-LowestNumber+1)*Rnd+LowestNumber)
SELECT CASE RandomNumber
CASE "1"%>
IMG SRC="/forum/banner1.gif" BORDER=0>
<%CASE "2"%>
IMG SRC="/forum/banner2.gif" BORDER=0>
<%CASE "3"%>
IMG SRC="/forum/banner3.gif" BORDER=0>
<%CASE "4"%>
IMG SRC="/forum/banner4.gif" BORDER=0>
<%CASE "5"%>
IMG SRC="/forum/banner5.gif" BORDER=0>
<%CASE "6"%>
IMG SRC="/forum/banner6.gif" BORDER=0>
<%CASE "7"%>
IMG SRC="/forum/banner7.gif" BORDER=0>
<%CASE "8"%>
IMG SRC="/forum/banner8.gif" BORDER=0>
<%CASE "9"%>
IMG SRC="/forum/banner9.gif" BORDER=0>
<%CASE "10"%>
IMG SRC="/forum/banner10.gif" BORDER=0>
<%END SELECT%>

as you can see - 1 represents the lowest number and 10 the highest and the script does the rest.
Of course you can optimise the code even more but hey it works!






© Copyright codetoad.com 2001-2005