[thelist] VBScript output randomizer

Viggie viggie at viggie.com
Wed Aug 12 22:24:39 CDT 2009


Hi Jenni,

With Bill's code, you don't need that array.    

He clearly listed out the randomizing part.   And in the html example he
used that random number directly in css.

see... <div class="dancer" id="dancer<%= touse %>"></div>   

the html output will be <div class="dancer" id="dancer1"></div>  or
id="dancer2", "dancer3",... etc.  

All you need apart from this code is to create necessary css for IDs
dancer1, 2, 3....etc.

Hope it helps,

cheers,
Viggie
__________________________
Helping websites to work
http://www.viggie.com 


On Tue, 2009-08-11 at 17:30 -0400, Jenni Beard wrote:

> Hi Bill, and thanks for the reply.  One thing I do not understand from this,
> is how it ties in to the array I've already created:
> 
> <%
> Dim dancer(3)
> 
> dancer(0)="#dancer1"
> dancer(1)="#dancer2"
> dancer(2)="#dancer3"
> dancer(3)="#dancer4"
> %>
> 
> Or, if I've not done the array correctly, how the code below will be written
> to tie it into the images that need to randomize.  Help please?
> 
> Thanks!!
> 
> Jenni
> 
> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Brian Cummiskey
> Sent: Monday, August 10, 2009 7:51 PM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] VBScript output randomizer
> 
> Hi Jenni,
> 
> 
> I would do something like this:
> 
> <%
> Function RandomNumber(intHighestNumber)
> 	Randomize
> 	RandomNumber = Int(intHighestNumber * Rnd) + 1
> End Function
> 
> 
> 'if you have 4 images, you would call it like this:
> 
> touse = RandomNumber(4)
> 
> %>
> 
> Then, touse will hold a value of 1,2,3, or 4.
> 
> using your css rules pre-defined, you can simply output like this:
> 
> <div class="dancer" id="dancer<%= touse %>"></div>



More information about the thelist mailing list