Print Page | Close Window

Random image on Refresh

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=21160
Printed Date: 29 March 2026 at 8:17am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Random image on Refresh
Posted By: Ninjai
Subject: Random image on Refresh
Date Posted: 28 August 2006 at 10:51pm
Hello there, I did a search and came up with nothing for asp so I ask for your help.

I would like the top left hand corner image on the WenWiz forum's homepage on my machine to display a random image of several I have in a folder, either everytime a user logs in or refreshes the page.

What coding would I need to put where for this to work?

Thanks.


-------------



Replies:
Posted By: michael
Date Posted: 29 August 2006 at 3:01pm

<% dim array(9)

randomize

array(1)="rdm1.gif"
array(2)="rdm2.gif"
array(3)="rdm3.gif"
array(4)="rdm4.gif"
array(5)="rdm5.gif"
array(6)="rdm6.gif"
array(7)="rdm7.gif"
array(8)="rdm8.gif"
array(9)="rdm9.gif"
array(0)="rdm0.gif"

upperbound=ubound(array)
lowerbound=0
lrandom = Int((upperbound - lowerbound + 1) * rnd + lowerbound)
response.write("<img src=""images/" & (Array(lrandom)) & """>")
%>

Just place that where the image is currently.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Ninjai
Date Posted: 29 August 2006 at 8:48pm
Thanks so just to clarify-if I want to use this on the front page top logo I would place it inside default.asp just after the code to display it?


-------------



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net