Welcome to Dream.In.Code
Become an Expert!

Join 150,105 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,902 people online right now. Registration is fast and FREE... Join Now!




Image Rotations AHHHH!

 
Reply to this topicStart new topic

Image Rotations AHHHH!

vb6_god
5 Jul, 2008 - 03:05 PM
Post #1

New D.I.C Head
*

Joined: 3 Dec, 2007
Posts: 26


My Contributions
Hi there people

Ok so i'm really confused with what i need to do here...I want to use VBscript in ASP

Ive created some javascript that will generate a random number and from that it will
select an image...named image1, image2, image3 etc......

I really want to create something so that i can add more pictures to it without having to redo the
code side of things. i.e. I just want to add images in the directory and make the code adapt.

Im using a variable to store the amount of images to rotate.. should i use an array..
can you add variables to an array without having to declare the array again ??
and what if i delete a picture the number in that array will still be there but an error will show , right ???

im a lil confused as you may tell. ..

here is my java

CODE


ImagesToRotate = 6;

FirstPart = '<img src="/Headers/image';
LastPart = '.jpg" height="134" width="806">';

function printImage() {
var r = Math.ceil(Math.random() * ImagesToRotate);
document.write(FirstPart + r + LastPart);
}




User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 12:56AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month