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!











CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Print and print preview file on the website without using the File - Print on the IE
•  Re: ASP.NET web controls
•  Re: JavaSript Problem In Mac Safari Browser
•  Re: DHTML div positionning Problem
•  Convert script to NS6 compatible - Please Help!
•  Print .doc file from the website using System.Diagnostics.Process
•  Re: Fullscreen code
•  Re: iframe targeting
•  Excel n ASP


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005