Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating Random images 3

Status
Not open for further replies.

jydeda

Technical User
May 31, 2006
8
GB
I am developing a simple browser based application to learn the notes on an istrument as related to a music stave. by loading up a variety associated images that retlate to each other.


How do I get the web browser to randomly select a sequence of images within a group and load them individualy into the browser frames at adjustable time intervals.

For Example I have 6 banks of images A, B, C, D, E, F. in a menu on a web page

Upon the users selection of group B for instance I want the browser to select randomly from a set of images B01. . . . .B24

Each of these has a sequence of 3 images it loads.

lets say it randomly selects B05 and loads this image into one of 3 frames on the page.
It should then proceed to call up B05-B, and B05-C and load them into the other 2 browser frames

The time interval between loading the images B05-B and B05-C should be adjustable in milliseconds

upon completing this operation it should then proceed to randomly select another from within the range B01-A. . . .B24-A and so on. I am told I can use the Random Math variable but haven't got a clue how to set this up
 
I'm confused.

You've posted your "question" by stating all the criteria that the program is supposed to follow. It looks almost like an assignment that a boss or teacher would give out.

Since you're not signing our paychecks or giving us computer degrees, what exactly are you expecting from us? What comes next, a due date?


I'm going to guess that you don't know the first thing about javascript. If that's the case you have 1 of 2 options:

1) learn it
2) pay someone to do this for you

Assuming you're interested in option #1, then here are a few pointers. Look up some javascript tutorials in google. They are a great way to learn the basics. With specific regard to your problem - you are right that you need to use the Math object to get a random number. But since you "haven't got a clue on how to set it up", why not google it instead of asking someone else to explain it. That just wastes time for both of us because I then have to spend the time explaining something that's already heavily documented somewhere else (why re-invent the wheel, ya know?) and you have to spend time waiting for someone to come along and explain it to you (no need since you can get your information immediately from google). On top of using the Math object to generate a random number, you should also google the javascript image object. That's how you'll be able to dynamically change the images on your page.

Fortunately for everyone that comes into this forum, javascript is a free language to code in. If you have a browser on your computer (which you do, otherwise how did you post your question?) then you can write your own javascript programs. You don't need to buy some fancy interface and compiler to get your code to run. Nope, you just pull up textpad, write up the javascript code, save it as an HTML file and run it in your browser. That's a great way to learn what you're doing.

What you've posted above is a bit much for a novice to take on because you've actually got about 4 or 5 different questions thrown in there (generating random numbers, dynamically changing images, using multi-dimensional arrays, etc.) It would be in your best interest to take a step back and learn these things one at a time. Google the Math object. Write a program to spit out random numbers between 1 and 10. Then write another program to spit out random numbers between -6 and 57. Play around. Experiment. Doing these small exercises will teach you enough to make questions like you posted above seem trivial.

If you get stuck on something, come back and post your code. Tell us where you're stuck. Tell us what you've tried. And likely one of us will be able to tell you what you've done wrong.

On the other hand, if you only intended to post the criteria for your project and expected someone to drop it in your lap then I don't think you're going to get much help - unless, of course, you're interested in hiring someone to do it for you.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
I'm sure this thread has been RF'd already, so I'll just throw in some closing words while the thread still exists.

I'm sure you found a condescending tone to the first part of my reply - but that's fine because I found a demanding tone from your original post. "Here's what I need, down to the specific detail. Now post the code to make it all work so I can drop it straight into my page"

It's clear from your post that you're semi-new to javascript. So I gave you a reply that would be helpful to a person that is semi-new to the language. I told you 3 topics that would help you get your task completed - javascript math object, javascript image object, multi-dimensional arrays. I also told you where you would find helpful information on these 3 topics.

If you don't know anything about the above 3 topics, then there's no need for anybody to try to explain anything further. Until you have done the research to know what those 3 things are, and how they work then what you're trying to attempt will be impossible for you. Period.

After the vulgarity you posted I don't expect you to be mature or professional enough to get anything helpful from my post - which is why you'll probably lose your account after a site administrator reviews your comment that was undoubtedly red-flagged. Oh well.... if you weren't able to get any helpful information from my reply then you probably don't deserve to be here anyway.

Hope you enjoyed your short visit.

The biggest tragedy about this whole thing is that I'm going to lose those 2 stars when the thread gets deleted. [lol]

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top