[thelist] VBScript output randomizer

Jenni Beard jenni at theweblotus.com
Tue Aug 11 16:30:40 CDT 2009


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