[thelist] VBScript output randomizer

Jenni Beard jenni at theweblotus.com
Mon Aug 10 18:43:04 CDT 2009

Hi all,


First off, I am new to this list, so hello and nice to "meet" you all!  I
have a stronger background in the marketing aspect of web development than
my coding abilities, so was thrilled when I found this list as I sometimes
run into challenges that no amount of Googling seems to solve.  I have one
now that I am hoping someone can help me with.


I am having a terrible time with this project.  I have a site design
(http://spiritmoves.com/new-site/graphics/draft4b.jpg) where the background
image of the dancer (this one is a placeholder until the photographer sends
me the real ones) to the right is going to be randomly switching out each
time a new page is loaded.  I will be coding the site layout in CSS.


I belong to a CSS group where I asked for and got some help on that end of
the issue.  I have searched for, and found, ASP code online that randomly
outputs an image from a designated folder.  But I did not know how to
integrate that with a css layout image.  The advice I received differs
greatly from the ASP code I've used in the past, though.  He suggested first
that I set up the following CSS:


.dancer {

      /* all of the styles for the element apart from bg-image */ }


#dancer1 { background-image: url(/path/to/image/dancer1.jpg); }

#dancer2 { background-image: url(/path/to/image/dancer2.jpg); }


And then, that I use in my html something like:


//Create an array, however that is done

['dancer1', 'dancer2', 'dancer3', 'dancer4']




<div id="<% a function that randomly output one of the strings from the
array %>" class="dancer">Content</div>


I'm still not sure this will work as I don't know if ASP and CSS can be used
in conjunction like that, but open to giving it a shot!


I've managed to create the following array, which I *think* is right:



Dim dancer(3)








But, when I get to the area to create the code to output the random div id,
I am stumped.  This should be really simple but I've spent literally hours
searching online and can find nothing that seems right.  Anyone?  I'm on
digest, so please cc me on replies.


Thanks in advance for any help you can offer!  



More information about the thelist mailing list