Re: Need help with random JPG display
by "Katrina Lobbia" <klobbia(at)hotmail.com>
|
Date: |
Tue, 02 May 2000 19:26:33 PDT |
To: |
steven(at)sqsystems.com, hwg-techniques(at)hwg.org, hwg-graphics(at)hwg.org |
|
todo: View
Thread,
Original
|
|
The code you need:
<!-------------start needed code------------------><PRE>
<script language=javascript>
var string="front";
//document.writeln(string);
var n = Math.round( (Math.random() * 3) + 1 );
//document.writeln(n);
var ext=".jpg";
//document.writeln(ext);
var img=string+n+ext;
//document.writeln(img);
var imgstr="<img src=";
var imgstr=imgstr+img;
var imgstr=imgstr+" border=0>";
document.writeln(imgstr);
//num = Math.round ( ( rand() * 10) );
//document.writeln(num);
</script>
</PRE><!-------------end needed code------------------>
Put this in your code where you want the image to appear... this will show
an image at random.... choosing either "Front1.jpg", 2, 3, or 4.
Feel free to change the word front as needed, I use it to remind me whats
what.
If you have any problems understanding what it all means, let me know, I can
go over it with you.
Its a nifty trick, and I use it quite often, for instance on my personal
website www.floatingpencil.com.
This works only for individual images. you can use it more than once in a
site.... as for tweaking the page to rotate alltogether, thats a little
trickier. the only way I know of doing that is through some heavy
programming and database work, as I did at
http://www.sophiesboutique.com/main.ihtml (still a work in progress, but the
rotation works... 6 whole color schemes if you press refresh)
Hope I was helpful...
~Katrina
From: Steven Stultz <steven(at)sqsystems.com>
To: HWG HTML Techniques Listserv <hwg-techniques(at)hwg.org>, HWG
Graphics Listserv <hwg-graphics(at)hwg.org>
Subject: Need help with random JPG display
Date: Tue, 02 May 2000 19:26:30 -0400
I'm new to the list, so please be patient.
I have need to incorporate into a web page the ability to display,
within a cell of a table, a JPEG file at random from a pool of four or
five. In other words, I would like the page to display, at random, a
different JPEG each time the page is loaded. Coming from a programming
background, mostly VB, I know that this should be possible (with
JavaScript perhaps?) but am not sure how to go about attacking the
issues.
Suggestions?
Thanks in advance.
Steven Stultz
--
Steven Q. Stultz
------------------------------------------------->
SQ Systems
Computers, Web Design, Support, & Programming
Serving Central Ohio & Cyberspace since 1991
mailto:steven(at)sqsystems.com
<http://www.sqsystems.com>
Looking For <http://sqsystems.com/notice.htm> New Clients
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
HWG: hwg-graphics mailing list archives,
maintained by Webmasters @ IWA